diff options
| author | aimuz <mr.imuz@gmail.com> | 2024-08-05 03:00:42 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-08-05 18:44:21 +0000 |
| commit | 677e080dfed1f17de76d4914cf4935b4914e9ddb (patch) | |
| tree | 227a9c520a83b22f22bfc56c21cbdd75a651b1dc /src/bytes/bytes_test.go | |
| parent | d465aee0b80b8eb0b63929deb8de0b21187c59a7 (diff) | |
| download | go-677e080dfed1f17de76d4914cf4935b4914e9ddb.tar.xz | |
bytes, strings: replace reflect.DeepEqual and custom eq with slices.Equal in tests
Change-Id: I016672af79d49a00ddc2d0449cdaac61e98b4ba0
GitHub-Last-Rev: 38d15d9a03e5bd29e4b25f1d767e40cf7165a7a6
GitHub-Pull-Request: golang/go#68730
Reviewed-on: https://go-review.googlesource.com/c/go/+/602698
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/bytes/bytes_test.go')
| -rw-r--r-- | src/bytes/bytes_test.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/bytes/bytes_test.go b/src/bytes/bytes_test.go index 94301358e0..6fb6140c18 100644 --- a/src/bytes/bytes_test.go +++ b/src/bytes/bytes_test.go @@ -10,7 +10,6 @@ import ( "internal/testenv" "math" "math/rand" - "reflect" "slices" "strings" "testing" @@ -814,8 +813,8 @@ func TestSplit(t *testing.T) { t.Errorf(`Join(Split(%q, %q, %d), %q) = %q`, tt.s, tt.sep, tt.n, tt.sep, s) } if tt.n < 0 { - b := Split([]byte(tt.s), []byte(tt.sep)) - if !reflect.DeepEqual(a, b) { + b := sliceOfString(Split([]byte(tt.s), []byte(tt.sep))) + if !slices.Equal(result, b) { t.Errorf("Split disagrees withSplitN(%q, %q, %d) = %v; want %v", tt.s, tt.sep, tt.n, b, a) } } @@ -869,8 +868,8 @@ func TestSplitAfter(t *testing.T) { t.Errorf(`Join(Split(%q, %q, %d), %q) = %q`, tt.s, tt.sep, tt.n, tt.sep, s) } if tt.n < 0 { - b := SplitAfter([]byte(tt.s), []byte(tt.sep)) - if !reflect.DeepEqual(a, b) { + b := sliceOfString(SplitAfter([]byte(tt.s), []byte(tt.sep))) + if !slices.Equal(result, b) { t.Errorf("SplitAfter disagrees withSplitAfterN(%q, %q, %d) = %v; want %v", tt.s, tt.sep, tt.n, b, a) } } |
