Subset 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.Subset(t, [1, 2, 3], [1, 2]) require.Subset(t, {"x": 1, "y": 2
(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{})
| 2029 | // require.Subset(t, [1, 2, 3], {1: "one", 2: "two"}) |
| 2030 | // require.Subset(t, {"x": 1, "y": 2}, ["x"]) |
| 2031 | func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) { |
| 2032 | if h, ok := t.(tHelper); ok { |
| 2033 | h.Helper() |
| 2034 | } |
| 2035 | if assert.Subset(t, list, subset, msgAndArgs...) { |
| 2036 | return |
| 2037 | } |
| 2038 | t.FailNow() |
| 2039 | } |
| 2040 | |
| 2041 | // Subsetf asserts that the list (array, slice, or map) contains all elements |
| 2042 | // given in the subset (array, slice, or map). |