unix: use slices.{Equal,Sort} in tests

Same as CL 587655 and CL 690475 did for package syscall tests.

Change-Id: Ie3c8726a4e2c859b5d7992ea1baec14083b9fdba
Reviewed-on: https://go-review.googlesource.com/c/sys/+/708558
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
This commit is contained in:
Tobias Klauser
2025-10-02 11:15:31 -07:00
committed by Gopher Robot
parent 5e63aa5e0f
commit ecada54126
2 changed files with 9 additions and 10 deletions
+5 -5
View File
@@ -12,7 +12,7 @@ import (
"os"
"path/filepath"
"runtime"
"sort"
"slices"
"strconv"
"strings"
"testing"
@@ -72,7 +72,7 @@ func TestDirent(t *testing.T) {
}
}
sort.Strings(names)
slices.Sort(names)
t.Logf("names: %q", names)
if len(names) != 10 {
@@ -145,9 +145,9 @@ func TestDirentRepeat(t *testing.T) {
}
// Check results
sort.Strings(files)
sort.Strings(files2)
if strings.Join(files, "|") != strings.Join(files2, "|") {
slices.Sort(files)
slices.Sort(files2)
if !slices.Equal(files, files2) {
t.Errorf("bad file list: want\n%q\ngot\n%q", files, files2)
}
}