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:
Franky W.
2025-11-06 16:03:38 +01:00
committed by GitHub
parent ed8ee742a6
commit 3f2e24e875
2 changed files with 6 additions and 7 deletions
-1
View File
@@ -147,7 +147,6 @@ func Intersect[T comparable, Slice ~[]T](lists ...Slice) Slice {
}
return result
}
// Difference returns the difference between two collections.
+6 -6
View File
@@ -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)