import (
. "os"
- "reflect"
+ "slices"
"strings"
"testing"
)
e0 := Environ()
for i := 0; i < 10; i++ {
e1 := Environ()
- if !reflect.DeepEqual(e0, e1) {
+ if !slices.Equal(e0, e1) {
t.Fatalf("environment changed")
}
}
package exec
import (
- "reflect"
+ "slices"
"testing"
)
}
for _, tt := range tests {
got, err := dedupEnvCase(tt.noCase, tt.nulOK, tt.in)
- if !reflect.DeepEqual(got, tt.want) || (err != nil) != tt.wantErr {
+ if !slices.Equal(got, tt.want) || (err != nil) != tt.wantErr {
t.Errorf("Dedup(%v, %q) = %q, %v; want %q, error:%v", tt.noCase, tt.in, got, err, tt.want, tt.wantErr)
}
}
"os"
"os/user"
"path/filepath"
- "reflect"
"runtime"
+ "slices"
"strconv"
"strings"
"syscall"
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"))
}
}
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"))
}
. "os"
"os/exec"
"path/filepath"
- "reflect"
"runtime"
"runtime/debug"
"slices"
}
if got, want := names(mustReadDir("initial readdir")),
- []string{"good1", "good2", "x"}; !reflect.DeepEqual(got, want) {
+ []string{"good1", "good2", "x"}; !slices.Equal(got, want) {
t.Errorf("initial readdir got %q; want %q", got, want)
}
xerr = ErrNotExist
if got, want := names(mustReadDir("with x disappearing")),
- []string{"good1", "good2"}; !reflect.DeepEqual(got, want) {
+ []string{"good1", "good2"}; !slices.Equal(got, want) {
t.Errorf("with x disappearing, got %q; want %q", got, want)
}
"os"
"os/exec"
"path/filepath"
- "reflect"
"runtime"
"slices"
"strings"
for len(want) < 5 {
want = append(want, "")
}
- if !reflect.DeepEqual(all, want) {
+ if !slices.Equal(all, want) {
t.Errorf("reading %q:\nhave %x\nwant %x", s, all, want)
}
})
"internal/testenv"
"os"
. "path/filepath"
- "reflect"
"runtime"
"slices"
"strings"
if err != nil {
t.Fatalf("Glob error for %q: %s", pattern, err)
}
- if !reflect.DeepEqual(matches, want) {
+ if !slices.Equal(matches, want) {
t.Fatalf("Glob(%#q) = %v want %v", pattern, matches, want)
}
}
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)
}
}
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)
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)
}
}
"os"
"os/exec"
"path/filepath"
- "reflect"
"runtime/debug"
+ "slices"
"strings"
"testing"
)
case err != nil:
t.Errorf("%d,%d: execution error %v\n%q", ti, i, err, out)
return
- case !reflect.DeepEqual(out, exp):
+ case !slices.Equal(out, exp):
t.Errorf("%d,%d: expected %#q, got %#q", ti, i, exp, out)
return
default:
"io"
"io/fs"
"path"
- "reflect"
"slices"
"strings"
"testing/iotest"
t.errorf("%s: Glob(%#q): %w", dir, glob, err)
return
}
- if reflect.DeepEqual(want, names) {
+ if slices.Equal(want, names) {
return
}
import (
"bytes"
"fmt"
- "reflect"
"regexp"
"runtime"
+ "slices"
"strings"
"sync"
"sync/atomic"
t.Cleanup(func() { cleanups = append(cleanups, 1) })
t.Cleanup(func() { cleanups = append(cleanups, 2) })
})
- if got, want := cleanups, []int{2, 1}; !reflect.DeepEqual(got, want) {
+ if got, want := cleanups, []int{2, 1}; !slices.Equal(got, want) {
t.Errorf("unexpected cleanup record; got %v want %v", got, want)
}
}