From a2431776ebc57ebc385d3fd9d3cc6eb89acb9d9c Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 25 Jul 2025 13:02:01 +0200 Subject: 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 Auto-Submit: Tobias Klauser Reviewed-by: Dmitri Shuralyov Reviewed-by: Cherry Mui --- src/path/filepath/match_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/path/filepath') diff --git a/src/path/filepath/match_test.go b/src/path/filepath/match_test.go index f415b04088..2ae79980c7 100644 --- a/src/path/filepath/match_test.go +++ b/src/path/filepath/match_test.go @@ -231,7 +231,7 @@ func (test *globTest) globAbs(root, rootPattern string) error { } slices.Sort(have) want := test.buildWant(root + `\`) - if strings.Join(want, "_") == strings.Join(have, "_") { + if slices.Equal(want, have) { return nil } return fmt.Errorf("Glob(%q) returns %q, but %q expected", p, have, want) @@ -245,12 +245,12 @@ func (test *globTest) globRel(root string) error { } slices.Sort(have) want := test.buildWant(root) - if strings.Join(want, "_") == strings.Join(have, "_") { + if slices.Equal(want, have) { return nil } // try also matching version without root prefix wantWithNoRoot := test.buildWant("") - if strings.Join(wantWithNoRoot, "_") == strings.Join(have, "_") { + if slices.Equal(wantWithNoRoot, have) { return nil } return fmt.Errorf("Glob(%q) returns %q, but %q expected", p, have, want) -- cgit v1.3-5-g9baa