diff options
| author | apocelipes <seve3r@outlook.com> | 2024-07-24 10:47:14 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-07-25 00:23:06 +0000 |
| commit | 05861ff90cfc855620d0dcbd1d6cc488ebf04880 (patch) | |
| tree | 72b56bbb48da1f66041fd9df85423740bb3f5120 /src/path/filepath/path_test.go | |
| parent | 0b0dfcd5404ce86d6c818d78bdb6348ded459e96 (diff) | |
| download | go-05861ff90cfc855620d0dcbd1d6cc488ebf04880.tar.xz | |
os,path/filepath,testing: use slices to clean up tests
Replace reflect.DeepEqual with slices.Equal which is much faster.
Change-Id: I299db6f998738174983731f08c1021346b87dfaa
GitHub-Last-Rev: 44ca9015d6af4e0fbe8d23c93b3f2da08a2d7728
GitHub-Pull-Request: golang/go#67613
Reviewed-on: https://go-review.googlesource.com/c/go/+/587938
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/path/filepath/path_test.go')
| -rw-r--r-- | src/path/filepath/path_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go index b24f39c5aa..5d3cbc991f 100644 --- a/src/path/filepath/path_test.go +++ b/src/path/filepath/path_test.go @@ -364,7 +364,7 @@ func TestSplitList(t *testing.T) { tests = append(tests, winsplitlisttests...) } for _, test := range tests { - if l := filepath.SplitList(test.list); !reflect.DeepEqual(l, test.result) { + if l := filepath.SplitList(test.list); !slices.Equal(l, test.result) { t.Errorf("SplitList(%#q) = %#q, want %#q", test.list, l, test.result) } } @@ -1004,7 +1004,7 @@ func TestWalkSymlinkRoot(t *testing.T) { t.Fatal(err) } - if !reflect.DeepEqual(walked, tt.want) { + if !slices.Equal(walked, tt.want) { t.Logf("Walk(%#q) visited %#q; want %#q", tt.root, walked, tt.want) if slices.Contains(tt.buggyGOOS, runtime.GOOS) { t.Logf("(ignoring known bug on %v)", runtime.GOOS) @@ -1950,7 +1950,7 @@ func TestIssue51617(t *testing.T) { t.Fatal(err) } want := []string{".", "a", filepath.Join("a", "bad"), filepath.Join("a", "next")} - if !reflect.DeepEqual(saw, want) { + if !slices.Equal(saw, want) { t.Errorf("got directories %v, want %v", saw, want) } } |
