diff options
| author | Tobias Klauser <tklauser@distanz.ch> | 2025-07-25 13:02:01 +0200 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-08-11 08:13:16 -0700 |
| commit | a2431776ebc57ebc385d3fd9d3cc6eb89acb9d9c (patch) | |
| tree | ab5dfc3d560f01a14b7c824e05e45d7531e64479 /src/syscall | |
| parent | a7f05b38f7e7beefd5ee54089aae59b21507bb3c (diff) | |
| download | go-a2431776ebc57ebc385d3fd9d3cc6eb89acb9d9c.tar.xz | |
net, os, file/filepath, syscall: use slices.Equal in tests
Use slices.Equal to compare slices instead of strings.Join and then
comparing strings.
Change-Id: Ib916002b7357bd7f4e66b853dd7af8d98eba5549
Reviewed-on: https://go-review.googlesource.com/c/go/+/690475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/syscall')
| -rw-r--r-- | src/syscall/dirent_test.go | 2 | ||||
| -rw-r--r-- | src/syscall/getdirentries_test.go | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/syscall/dirent_test.go b/src/syscall/dirent_test.go index cfa5478feb..173ccc3ed2 100644 --- a/src/syscall/dirent_test.go +++ b/src/syscall/dirent_test.go @@ -140,7 +140,7 @@ func TestDirentRepeat(t *testing.T) { // Check results slices.Sort(files) slices.Sort(files2) - if strings.Join(files, "|") != strings.Join(files2, "|") { + if !slices.Equal(files, files2) { t.Errorf("bad file list: want\n%q\ngot\n%q", files, files2) } } diff --git a/src/syscall/getdirentries_test.go b/src/syscall/getdirentries_test.go index 5d401d8dd6..b5361ddaef 100644 --- a/src/syscall/getdirentries_test.go +++ b/src/syscall/getdirentries_test.go @@ -11,7 +11,6 @@ import ( "os" "path/filepath" "slices" - "strings" "syscall" "testing" "unsafe" @@ -78,7 +77,7 @@ func testGetdirentries(t *testing.T, count int) { names = append(names, ".", "..") // Getdirentries returns these also slices.Sort(names) slices.Sort(names2) - if strings.Join(names, ":") != strings.Join(names2, ":") { + if !slices.Equal(names, names2) { t.Errorf("names don't match\n names: %q\nnames2: %q", names, names2) } } |
