From 05861ff90cfc855620d0dcbd1d6cc488ebf04880 Mon Sep 17 00:00:00 2001 From: apocelipes Date: Wed, 24 Jul 2024 10:47:14 +0000 Subject: 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor --- src/os/exec/exec_posix_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/os/exec/exec_posix_test.go') diff --git a/src/os/exec/exec_posix_test.go b/src/os/exec/exec_posix_test.go index 5d828b3475..45604203dd 100644 --- a/src/os/exec/exec_posix_test.go +++ b/src/os/exec/exec_posix_test.go @@ -13,8 +13,8 @@ import ( "os" "os/user" "path/filepath" - "reflect" "runtime" + "slices" "strconv" "strings" "syscall" @@ -184,7 +184,7 @@ func TestImplicitPWD(t *testing.T) { wantPWDs = nil } } - if !reflect.DeepEqual(pwds, wantPWDs) { + if !slices.Equal(pwds, wantPWDs) { t.Errorf("PWD entries in cmd.Environ():\n\t%s\nwant:\n\t%s", strings.Join(pwds, "\n\t"), strings.Join(wantPWDs, "\n\t")) } @@ -257,7 +257,7 @@ func TestExplicitPWD(t *testing.T) { } wantPWDs := []string{tc.pwd} - if !reflect.DeepEqual(pwds, wantPWDs) { + if !slices.Equal(pwds, wantPWDs) { t.Errorf("PWD entries in cmd.Environ():\n\t%s\nwant:\n\t%s", strings.Join(pwds, "\n\t"), strings.Join(wantPWDs, "\n\t")) } -- cgit v1.3