Skip to content

Commit 4a25f3a

Browse files
committed
AllEqual: Simpler
1 parent 337529b commit 4a25f3a

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

be.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package be
22

33
import (
44
"reflect"
5+
"slices"
56
"testing"
67
)
78

@@ -24,15 +25,8 @@ func Unequal[T comparable](t testing.TB, bad, got T) {
2425
// AllEqual calls t.Fatalf if want != got.
2526
func AllEqual[T comparable](t testing.TB, want, got []T) {
2627
t.Helper()
27-
if len(want) != len(got) {
28+
if !slices.Equal(want, got) {
2829
t.Fatalf("want: %v; got: %v", want, got)
29-
return
30-
}
31-
for i := range want {
32-
if want[i] != got[i] {
33-
t.Fatalf("want: %v; got: %v", want, got)
34-
return
35-
}
3630
}
3731
}
3832

0 commit comments

Comments
 (0)