Skip to content

Commit

Permalink
Add map support doc comments to Subset and NotSubset
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Chadwell <me@jedevc.com>
  • Loading branch information
jedevc committed Nov 24, 2022
1 parent 1333b5d commit 59f4c29
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions assert/assertions.go
Expand Up @@ -806,10 +806,11 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{})

}

// Subset asserts that the specified list(array, slice...) contains all
// elements given in the specified subset(array, slice...).
// Subset asserts that the specified list(array, slice...) or map contains all
// elements given in the specified subset list(array, slice...) or map.
//
// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
// assert.Subset(t, {"x": 1, "y": 2}, {"x": 1}, "But {"x": 1, "y": 2} does contain {"x": 1}")
func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand Down Expand Up @@ -867,10 +868,11 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok
return true
}

// NotSubset asserts that the specified list(array, slice...) contains not all
// elements given in the specified subset(array, slice...).
// NotSubset asserts that the specified list(array, slice...) or map contains not all
// elements given in the specified subset list(array, slice...) or map.
//
// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
// assert.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}, "But {"x": 1, "y": 2} does not contain {"z": 3}")
func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand Down

0 comments on commit 59f4c29

Please sign in to comment.