diff options
| author | apocelipes <seve3r@outlook.com> | 2024-07-24 10:32:22 +0000 |
|---|---|---|
| committer | Robert Griesemer <gri@google.com> | 2024-07-24 18:45:08 +0000 |
| commit | c0eac35a4cd3ca16d3d1fc153a155b0b18f49633 (patch) | |
| tree | d0b5071068940ae7a1bcce685a80828dc95e02d8 /src/strings/strings_test.go | |
| parent | 910e6b5fae7cbf84e4a3fcfa6739e20239080bcd (diff) | |
| download | go-c0eac35a4cd3ca16d3d1fc153a155b0b18f49633.tar.xz | |
bytes,strings,unicode/utf16: use slices to clean up tests
Replace reflect.DeepEqual with slices.Equal, which is much faster.
Remove some redundant helper functions.
Change-Id: I51b32a3d0c3fc5ad0d3b6ff0dd03f39c507e5762
GitHub-Last-Rev: e21f46d4a026b6bf6e8d912dfb8d361a20a4e779
GitHub-Pull-Request: golang/go#67609
Reviewed-on: https://go-review.googlesource.com/c/go/+/587937
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Diffstat (limited to 'src/strings/strings_test.go')
| -rw-r--r-- | src/strings/strings_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/strings/strings_test.go b/src/strings/strings_test.go index 4bd3a3c202..4c8c25ee13 100644 --- a/src/strings/strings_test.go +++ b/src/strings/strings_test.go @@ -10,7 +10,7 @@ import ( "io" "math" "math/rand" - "reflect" + "slices" "strconv" . "strings" "testing" @@ -431,7 +431,7 @@ func TestSplit(t *testing.T) { } if tt.n < 0 { b := Split(tt.s, tt.sep) - if !reflect.DeepEqual(a, b) { + if !slices.Equal(a, b) { t.Errorf("Split disagrees with SplitN(%q, %q, %d) = %v; want %v", tt.s, tt.sep, tt.n, b, a) } } @@ -467,7 +467,7 @@ func TestSplitAfter(t *testing.T) { } if tt.n < 0 { b := SplitAfter(tt.s, tt.sep) - if !reflect.DeepEqual(a, b) { + if !slices.Equal(a, b) { t.Errorf("SplitAfter disagrees with SplitAfterN(%q, %q, %d) = %v; want %v", tt.s, tt.sep, tt.n, b, a) } } |
