NotContainsAll succeeds if array does not contain at least one of the elements. Before comparison, array and all elements are converted to canonical form. Example: array := NewArray(t, []interface{}{"foo", 123}) array.NotContainsAll("bar") // success array.NotContainsAll(123, "foo")
(values ...interface{})
| 1305 | // array.NotContainsAll("bar") // success |
| 1306 | // array.NotContainsAll(123, "foo") // failure |
| 1307 | func (a *Array) NotContainsAll(values ...interface{}) *Array { |
| 1308 | opChain := a.chain.enter("NotContainsAll()") |
| 1309 | defer opChain.leave() |
| 1310 | |
| 1311 | if opChain.failed() { |
| 1312 | return a |
| 1313 | } |
| 1314 | |
| 1315 | elements, ok := canonArray(opChain, values) |
| 1316 | if !ok { |
| 1317 | return a |
| 1318 | } |
| 1319 | |
| 1320 | haveMissing := false |
| 1321 | |
| 1322 | for _, expected := range elements { |
| 1323 | if countElement(a.value, expected) == 0 { |
| 1324 | haveMissing = true |
| 1325 | break |
| 1326 | } |
| 1327 | } |
| 1328 | |
| 1329 | if !haveMissing { |
| 1330 | opChain.fail(AssertionFailure{ |
| 1331 | Type: AssertNotContainsElement, |
| 1332 | Actual: &AssertionValue{a.value}, |
| 1333 | Reference: &AssertionValue{values}, |
| 1334 | Errors: []error{ |
| 1335 | errors.New("expected:" + |
| 1336 | " array does not contain at least one element from reference array"), |
| 1337 | }, |
| 1338 | }) |
| 1339 | } |
| 1340 | |
| 1341 | return a |
| 1342 | } |
| 1343 | |
| 1344 | // ContainsAny succeeds if array contains at least one element from the given elements. |
| 1345 | // Before comparison, array and all elements are converted to canonical form. |