@@ -982,11 +982,15 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{})
982982
983983}
984984
985- // Subset asserts that the specified list(array, slice...) or map contains all
986- // elements given in the specified subset list(array, slice...) or map.
985+ // Subset asserts that the list (array, slice, or map) contains all elements
986+ // given in the subset (array, slice, or map).
987+ // Map elements are key-value pairs unless compared with an array or slice where
988+ // only the map key is evaluated.
987989//
988990// assert.Subset(t, [1, 2, 3], [1, 2])
989991// assert.Subset(t, {"x": 1, "y": 2}, {"x": 1})
992+ // assert.Subset(t, [1, 2, 3], {1: "one", 2: "two"})
993+ // assert.Subset(t, {"x": 1, "y": 2}, ["x"])
990994func Subset (t TestingT , list , subset interface {}, msgAndArgs ... interface {}) (ok bool ) {
991995 if h , ok := t .(tHelper ); ok {
992996 h .Helper ()
@@ -1046,12 +1050,15 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok
10461050 return true
10471051}
10481052
1049- // NotSubset asserts that the specified list(array, slice...) or map does NOT
1050- // contain all elements given in the specified subset list(array, slice...) or
1051- // map.
1053+ // NotSubset asserts that the list (array, slice, or map) does NOT contain all
1054+ // elements given in the subset (array, slice, or map).
1055+ // Map elements are key-value pairs unless compared with an array or slice where
1056+ // only the map key is evaluated.
10521057//
10531058// assert.NotSubset(t, [1, 3, 4], [1, 2])
10541059// assert.NotSubset(t, {"x": 1, "y": 2}, {"z": 3})
1060+ // assert.NotSubset(t, [1, 3, 4], {1: "one", 2: "two"})
1061+ // assert.NotSubset(t, {"x": 1, "y": 2}, ["z"])
10551062func NotSubset (t TestingT , list , subset interface {}, msgAndArgs ... interface {}) (ok bool ) {
10561063 if h , ok := t .(tHelper ); ok {
10571064 h .Helper ()
0 commit comments