Skip to content

Commit 17a41bd

Browse files
authored
Merge pull request thoas#104 from ahuigo/master
bugfix: Subset(["a","k"],["a","b"]) should return false
2 parents e5885af + e2384c7 commit 17a41bd

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

subset.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ func Subset(x interface{}, y interface{}) bool {
3535
if !Contains(yValue.Interface(), xValue.Index(i).Interface()) {
3636
return false
3737
}
38-
return true
3938
}
4039

41-
return false
42-
40+
return true
4341
}

subset_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ func TestSubset(t *testing.T) {
1414
r = Subset([]string{"foo", "bar"},[]string{"foo", "bar", "hello", "bar", "hi"})
1515
is.True(r)
1616

17+
r = Subset([]string{"foo", "bar","extra"},[]string{"foo", "bar", "hello", "bar", "hi"})
18+
is.False(r)
19+
1720
r = Subset([]string{"hello", "foo", "bar", "hello", "bar", "hi"}, []string{})
1821
is.False(r)
1922

0 commit comments

Comments
 (0)