mirror of
https://github.com/samber/lo.git
synced 2026-04-22 15:37:14 +08:00
Intersect CI test fix (#731)
* Fix linting * Use is.ElementsMatch This will ignore the ordering of the final intersection. Especially important when checking old versions of go that do not guarantee an order when iterating through maps.
This commit is contained in:
@@ -147,7 +147,6 @@ func Intersect[T comparable, Slice ~[]T](lists ...Slice) Slice {
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
}
|
||||
|
||||
// Difference returns the difference between two collections.
|
||||
|
||||
+6
-6
@@ -188,13 +188,13 @@ func TestIntersect(t *testing.T) {
|
||||
result9 := Intersect([]int{0, 1, 1}, []int{2})
|
||||
|
||||
is.Empty(result0)
|
||||
is.Equal([]int{1}, result1)
|
||||
is.Equal([]int{0, 2}, result2)
|
||||
is.Equal([]int{0}, result3)
|
||||
is.ElementsMatch([]int{1}, result1)
|
||||
is.ElementsMatch([]int{0, 2}, result2)
|
||||
is.ElementsMatch([]int{0}, result3)
|
||||
is.Empty(result4)
|
||||
is.Equal([]int{0}, result5)
|
||||
is.Equal([]int{0}, result6)
|
||||
is.Equal([]int{0}, result7)
|
||||
is.ElementsMatch([]int{0}, result5)
|
||||
is.ElementsMatch([]int{0}, result6)
|
||||
is.ElementsMatch([]int{0}, result7)
|
||||
is.Empty(result8)
|
||||
is.Empty(result9)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user