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{})
| 38 | // require.Contains(t, ["Hello", "World"], "World") |
| 39 | // require.Contains(t, {"Hello": "World"}, "Hello") |
| 40 | func 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. |