diff options
| author | apocelipes <seve3r@outlook.com> | 2024-07-24 10:39:58 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-07-25 00:22:14 +0000 |
| commit | 2247afc0aee41434a4e874af07d026f828bd3210 (patch) | |
| tree | 939cfa7ec182e2c0fb80c1125841ee54c50e48a9 /src/internal/profile | |
| parent | 1d717951f518a9e818e8b98d4daed17756c394ca (diff) | |
| download | go-2247afc0aee41434a4e874af07d026f828bd3210.tar.xz | |
go,internal,io,mime: use slices and maps to clean tests
Replace reflect.DeepEqual with slices.Equal/maps.Equal, which is
much faster.
Change-Id: Id9cb550884da817da96befdeccfecb3325fb4414
GitHub-Last-Rev: 7d64d78feb86e3ea1af6c24ea6782cb85731bb52
GitHub-Pull-Request: golang/go#67612
Reviewed-on: https://go-review.googlesource.com/c/go/+/587819
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/internal/profile')
| -rw-r--r-- | src/internal/profile/proto_test.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/internal/profile/proto_test.go b/src/internal/profile/proto_test.go index 46c6d83063..4c09f7c47e 100644 --- a/src/internal/profile/proto_test.go +++ b/src/internal/profile/proto_test.go @@ -5,7 +5,7 @@ package profile import ( - "reflect" + "slices" "testing" ) @@ -34,7 +34,7 @@ func TestPackedEncoding(t *testing.T) { }, } { source := &packedInts{tc.uint64s, tc.int64s} - if got, want := marshal(source), tc.encoded; !reflect.DeepEqual(got, want) { + if got, want := marshal(source), tc.encoded; !slices.Equal(got, want) { t.Errorf("failed encode %d, got %v, want %v", i, got, want) } @@ -43,10 +43,10 @@ func TestPackedEncoding(t *testing.T) { t.Errorf("failed decode %d: %v", i, err) continue } - if got, want := dest.uint64s, tc.uint64s; !reflect.DeepEqual(got, want) { + if got, want := dest.uint64s, tc.uint64s; !slices.Equal(got, want) { t.Errorf("failed decode uint64s %d, got %v, want %v", i, got, want) } - if got, want := dest.int64s, tc.int64s; !reflect.DeepEqual(got, want) { + if got, want := dest.int64s, tc.int64s; !slices.Equal(got, want) { t.Errorf("failed decode int64s %d, got %v, want %v", i, got, want) } } |
