MCPcopy
hub / github.com/stretchr/testify / Subset

Function Subset

require/require.go:2031–2039  ·  view source on GitHub ↗

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{})

Source from the content-addressed store, hash-verified

2029// require.Subset(t, [1, 2, 3], {1: "one", 2: "two"})
2030// require.Subset(t, {"x": 1, "y": 2}, ["x"])
2031func 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).

Callers 1

SubsetMethod · 0.70

Calls 3

SubsetFunction · 0.92
HelperMethod · 0.65
FailNowMethod · 0.65

Tested by

no test coverage detected