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

Method Contains

array.go:1197–1226  ·  view source on GitHub ↗

Deprecated: use ContainsAll or ContainsAny instead.

(values ...interface{})

Source from the content-addressed store, hash-verified

1195
1196// Deprecated: use ContainsAll or ContainsAny instead.
1197func (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.
1229func (a *Array) NotContains(values ...interface{}) *Array {

Callers 15

TestChain_StacktraceFunction · 0.45
TestFastBinder_LoggerFunction · 0.45
TestString_FailedChainFunction · 0.45
TestString_ContainsFunction · 0.45
TestArray_FailedChainFunction · 0.45
TestArray_ContainsFunction · 0.45
TestExpect_AdaptersFunction · 0.45

Calls 6

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

Tested by 15

TestChain_StacktraceFunction · 0.36
TestFastBinder_LoggerFunction · 0.36
TestString_FailedChainFunction · 0.36
TestString_ContainsFunction · 0.36
TestArray_FailedChainFunction · 0.36
TestArray_ContainsFunction · 0.36
TestExpect_AdaptersFunction · 0.36