Skip to content

Commit

Permalink
Merge pull request #104 from ahuigo/master
Browse files Browse the repository at this point in the history
bugfix: Subset(["a","k"],["a","b"]) should return false
  • Loading branch information
thoas committed Nov 28, 2020
2 parents e5885af + e2384c7 commit 17a41bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions subset.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ func Subset(x interface{}, y interface{}) bool {
if !Contains(yValue.Interface(), xValue.Index(i).Interface()) {
return false
}
return true
}

return false

return true
}
3 changes: 3 additions & 0 deletions subset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ func TestSubset(t *testing.T) {
r = Subset([]string{"foo", "bar"},[]string{"foo", "bar", "hello", "bar", "hi"})
is.True(r)

r = Subset([]string{"foo", "bar","extra"},[]string{"foo", "bar", "hello", "bar", "hi"})
is.False(r)

r = Subset([]string{"hello", "foo", "bar", "hello", "bar", "hi"}, []string{})
is.False(r)

Expand Down

0 comments on commit 17a41bd

Please sign in to comment.