Subsetf asserts that the list (array, slice, or map) contains all elements given in the subset (array, slice, or map). Map elements are key-value pairs unless compared with an array or slice where only the map key is evaluated. require.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted")
(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{})
| 2048 | // require.Subsetf(t, [1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") |
| 2049 | // require.Subsetf(t, {"x": 1, "y": 2}, ["x"], "error message %s", "formatted") |
| 2050 | func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) { |
| 2051 | if h, ok := t.(tHelper); ok { |
| 2052 | h.Helper() |
| 2053 | } |
| 2054 | if assert.Subsetf(t, list, subset, msg, args...) { |
| 2055 | return |
| 2056 | } |
| 2057 | t.FailNow() |
| 2058 | } |
| 2059 | |
| 2060 | // True asserts that the specified value is true. |
| 2061 | // |