MCPcopy
hub / github.com/stretchr/testify / Contains

Function Contains

require/require.go:40–48  ·  view source on GitHub ↗

Contains asserts that the specified string, list(array, slice...) or map contains the specified substring or element. require.Contains(t, "Hello World", "World") require.Contains(t, ["Hello", "World"], "World") require.Contains(t, {"Hello": "World"}, "Hello")

(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

38// require.Contains(t, ["Hello", "World"], "World")
39// require.Contains(t, {"Hello": "World"}, "Hello")
40func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
41 if h, ok := t.(tHelper); ok {
42 h.Helper()
43 }
44 if assert.Contains(t, s, contains, msgAndArgs...) {
45 return
46 }
47 t.FailNow()
48}
49
50// Containsf asserts that the specified string, list(array, slice...) or map contains the
51// specified substring or element.

Callers 2

ContainsMethod · 0.70
TestContainsFunction · 0.70

Calls 3

ContainsFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by 1

TestContainsFunction · 0.56