Deprecated: use ContainsAll or ContainsAny instead.
(values ...interface{})
| 1195 | |
| 1196 | // Deprecated: use ContainsAll or ContainsAny instead. |
| 1197 | func (a *Array) Contains(values ...interface{}) *Array { |
| 1198 | opChain := a.chain.enter("Contains()") |
| 1199 | defer opChain.leave() |
| 1200 | |
| 1201 | if opChain.failed() { |
| 1202 | return a |
| 1203 | } |
| 1204 | |
| 1205 | elements, ok := canonArray(opChain, values) |
| 1206 | if !ok { |
| 1207 | return a |
| 1208 | } |
| 1209 | |
| 1210 | for _, expected := range elements { |
| 1211 | if countElement(a.value, expected) == 0 { |
| 1212 | opChain.fail(AssertionFailure{ |
| 1213 | Type: AssertContainsElement, |
| 1214 | Actual: &AssertionValue{a.value}, |
| 1215 | Expected: &AssertionValue{expected}, |
| 1216 | Reference: &AssertionValue{values}, |
| 1217 | Errors: []error{ |
| 1218 | errors.New("expected: array contains element from reference array"), |
| 1219 | }, |
| 1220 | }) |
| 1221 | break |
| 1222 | } |
| 1223 | } |
| 1224 | |
| 1225 | return a |
| 1226 | } |
| 1227 | |
| 1228 | // Deprecated: use NotContainsAll or NotContainsAny instead. |
| 1229 | func (a *Array) NotContains(values ...interface{}) *Array { |