MCPcopy Index your code
hub / github.com/gavv/httpexpect / NotContainsAny

Method NotContainsAny

array.go:1397–1427  ·  view source on GitHub ↗

NotContainsAny succeeds if none of the given elements are in the array. Before comparison, array and all elements are converted to canonical form. Example: array := NewArray(t, []interface{}{"foo", 123}) array.NotContainsAny("bar", 124) // success array.NotContainsAny(123) // failure

(values ...interface{})

Source from the content-addressed store, hash-verified

1395// array.NotContainsAny("bar", 124) // success
1396// array.NotContainsAny(123) // failure
1397func (a *Array) NotContainsAny(values ...interface{}) *Array {
1398 opChain := a.chain.enter("NotContainsAny()")
1399 defer opChain.leave()
1400
1401 if opChain.failed() {
1402 return a
1403 }
1404
1405 elements, ok := canonArray(opChain, values)
1406 if !ok {
1407 return a
1408 }
1409
1410 for _, expected := range elements {
1411 if countElement(a.value, expected) != 0 {
1412 opChain.fail(AssertionFailure{
1413 Type: AssertNotContainsElement,
1414 Actual: &AssertionValue{a.value},
1415 Expected: &AssertionValue{expected},
1416 Reference: &AssertionValue{values},
1417 Errors: []error{
1418 errors.New("expected:" +
1419 " array does not contain any elements from reference array"),
1420 },
1421 })
1422 return a
1423 }
1424 }
1425
1426 return a
1427}
1428
1429// ContainsOnly succeeds if array contains all given elements, in any order, and only
1430// them, ignoring duplicates. Before comparison, array and all elements are converted

Callers 2

TestArray_FailedChainFunction · 0.80
TestArray_ContainsAnyFunction · 0.80

Calls 6

canonArrayFunction · 0.85
countElementFunction · 0.85
enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80
failMethod · 0.80

Tested by 2

TestArray_FailedChainFunction · 0.64
TestArray_ContainsAnyFunction · 0.64