diff options
Diffstat (limited to 'src/encoding/gob/encoder_test.go')
| -rw-r--r-- | src/encoding/gob/encoder_test.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/encoding/gob/encoder_test.go b/src/encoding/gob/encoder_test.go index efb13bc83b..3ee43fbc94 100644 --- a/src/encoding/gob/encoder_test.go +++ b/src/encoding/gob/encoder_test.go @@ -10,6 +10,7 @@ import ( "encoding/hex" "fmt" "io" + "maps" "math" "reflect" "slices" @@ -74,7 +75,7 @@ func TestEncodeIntSlice(t *testing.T) { res := make([]int8, 9) dec.Decode(&res) - if !reflect.DeepEqual(s8, res) { + if !slices.Equal(s8, res) { t.Fatalf("EncodeIntSlice: expected %v, got %v", s8, res) } }) @@ -88,7 +89,7 @@ func TestEncodeIntSlice(t *testing.T) { res := make([]int16, 9) dec.Decode(&res) - if !reflect.DeepEqual(s16, res) { + if !slices.Equal(s16, res) { t.Fatalf("EncodeIntSlice: expected %v, got %v", s16, res) } }) @@ -102,7 +103,7 @@ func TestEncodeIntSlice(t *testing.T) { res := make([]int32, 9) dec.Decode(&res) - if !reflect.DeepEqual(s32, res) { + if !slices.Equal(s32, res) { t.Fatalf("EncodeIntSlice: expected %v, got %v", s32, res) } }) @@ -116,7 +117,7 @@ func TestEncodeIntSlice(t *testing.T) { res := make([]int64, 9) dec.Decode(&res) - if !reflect.DeepEqual(s64, res) { + if !slices.Equal(s64, res) { t.Fatalf("EncodeIntSlice: expected %v, got %v", s64, res) } }) @@ -689,7 +690,7 @@ func TestMapBug1(t *testing.T) { if err != nil { t.Fatal("decode:", err) } - if !reflect.DeepEqual(in, out) { + if !maps.Equal(in, out) { t.Errorf("mismatch: %v %v", in, out) } } @@ -763,7 +764,7 @@ func TestSliceReusesMemory(t *testing.T) { if err != nil { t.Fatal("ints: decode:", err) } - if !reflect.DeepEqual(x, y) { + if !slices.Equal(x, y) { t.Errorf("ints: expected %q got %q\n", x, y) } if addr != &y[0] { @@ -1199,7 +1200,7 @@ func TestMarshalFloatMap(t *testing.T) { got := readMap(out) want := readMap(in) - if !reflect.DeepEqual(got, want) { + if !slices.Equal(got, want) { t.Fatalf("\nEncode: %v\nDecode: %v", want, got) } } |
