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

Method NotContainsAll

array.go:1307–1342  ·  view source on GitHub ↗

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{})

Source from the content-addressed store, hash-verified

1305// array.NotContainsAll("bar") // success
1306// array.NotContainsAll(123, "foo") // failure
1307func (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.

Callers 4

TestArray_FailedChainFunction · 0.80
TestArray_ContainsAllFunction · 0.80
TestE2EReport_LineWidthFunction · 0.80

Calls 6

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

Tested by 4

TestArray_FailedChainFunction · 0.64
TestArray_ContainsAllFunction · 0.64
TestE2EReport_LineWidthFunction · 0.64