Containsf asserts that the specified string, list(array, slice...) or map contains the specified substring or element. require.Containsf(t, "Hello World", "World", "error message %s", "formatted") require.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted") require.Contains
(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{})
| 54 | // require.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted") |
| 55 | // require.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted") |
| 56 | func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) { |
| 57 | if h, ok := t.(tHelper); ok { |
| 58 | h.Helper() |
| 59 | } |
| 60 | if assert.Containsf(t, s, contains, msg, args...) { |
| 61 | return |
| 62 | } |
| 63 | t.FailNow() |
| 64 | } |
| 65 | |
| 66 | // DirExists checks whether a directory exists in the given path. It also fails |
| 67 | // if the path is a file rather a directory or there is an error checking whether it exists. |