aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/map_test.go
diff options
context:
space:
mode:
authorapocelipes <seve3r@outlook.com>2024-07-24 10:24:06 +0000
committerGopher Robot <gobot@golang.org>2024-07-25 00:23:03 +0000
commit0b0dfcd5404ce86d6c818d78bdb6348ded459e96 (patch)
treef7c8fc3cb49a90afd15e14aec43ca763c301c4b8 /src/runtime/map_test.go
parent2247afc0aee41434a4e874af07d026f828bd3210 (diff)
downloadgo-0b0dfcd5404ce86d6c818d78bdb6348ded459e96.tar.xz
runtime: use slices and maps to clean up tests
Replace reflect.DeepEqual with slices.Equal/maps.Equal, which is much faster. Also remove some unecessary helper functions. Change-Id: I3e4fa2938fed1598278c9e556cd4fa3b9ed3ad6d GitHub-Last-Rev: 69bb43fc6e5c4a4a7d028528fe00b43db784464e GitHub-Pull-Request: golang/go#67603 Reviewed-on: https://go-review.googlesource.com/c/go/+/587815 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/runtime/map_test.go')
-rw-r--r--src/runtime/map_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/map_test.go b/src/runtime/map_test.go
index 13624e0938..ba2ea74649 100644
--- a/src/runtime/map_test.go
+++ b/src/runtime/map_test.go
@@ -144,7 +144,7 @@ func TestMapAppendAssignment(t *testing.T) {
m[0] = append(m[0], a...)
want := []int{12345, 67890, 123, 456, 7, 8, 9, 0}
- if got := m[0]; !reflect.DeepEqual(got, want) {
+ if got := m[0]; !slices.Equal(got, want) {
t.Errorf("got %v, want %v", got, want)
}
}
@@ -533,7 +533,7 @@ func TestMapIterOrder(t *testing.T) {
first := ord()
ok := false
for try := 0; try < 100; try++ {
- if !reflect.DeepEqual(first, ord()) {
+ if !slices.Equal(first, ord()) {
ok = true
break
}