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