aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2023-06-16 14:46:37 -0400
committerGopher Robot <gobot@golang.org>2023-06-16 19:37:46 +0000
commitc1bc44642db321c2f125fd043c220cac08877e95 (patch)
treecb05a273b9ba09ddac763d552f67982ae7a75805
parent9ece9a7ac9befbb8ee8f2241063a2389b730cdaf (diff)
downloadgo-c1bc44642db321c2f125fd043c220cac08877e95.tar.gz
go-c1bc44642db321c2f125fd043c220cac08877e95.zip
path/filepath: avoid assuming that GOROOT/test is present
GOROOT/test is pruned out by cmd/distpack. It isn't really needed for the test anyway; the test can instead use the "src/unicode" subdirectory, which is even within the same module. This test was previously adjusted in CL 13467045 and CL 31859. Unlike in previous iterations of the test, the directories used in this revision are covered by the Go 1 compatibility policy and thus unlikely to disappear. For #24904. Change-Id: I156ae18354bcbc2ddd8d22b210f16ba1e97cd5d1 Reviewed-on: https://go-review.googlesource.com/c/go/+/504116 Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com>
-rw-r--r--src/path/filepath/path_test.go31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go
index 469a107d14..3c78e415d2 100644
--- a/src/path/filepath/path_test.go
+++ b/src/path/filepath/path_test.go
@@ -1622,36 +1622,33 @@ func TestBug3486(t *testing.T) { // https://golang.org/issue/3486
if runtime.GOOS == "ios" {
t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH)
}
- root, err := filepath.EvalSymlinks(testenv.GOROOT(t) + "/test")
- if err != nil {
- t.Fatal(err)
- }
- bugs := filepath.Join(root, "fixedbugs")
- ken := filepath.Join(root, "ken")
- seenBugs := false
- seenKen := false
- err = filepath.Walk(root, func(pth string, info fs.FileInfo, err error) error {
+ root := filepath.Join(testenv.GOROOT(t), "src", "unicode")
+ utf16 := filepath.Join(root, "utf16")
+ utf8 := filepath.Join(root, "utf8")
+ seenUTF16 := false
+ seenUTF8 := false
+ err := filepath.Walk(root, func(pth string, info fs.FileInfo, err error) error {
if err != nil {
t.Fatal(err)
}
switch pth {
- case bugs:
- seenBugs = true
+ case utf16:
+ seenUTF16 = true
return filepath.SkipDir
- case ken:
- if !seenBugs {
- t.Fatal("filepath.Walk out of order - ken before fixedbugs")
+ case utf8:
+ if !seenUTF16 {
+ t.Fatal("filepath.Walk out of order - utf8 before utf16")
}
- seenKen = true
+ seenUTF8 = true
}
return nil
})
if err != nil {
t.Fatal(err)
}
- if !seenKen {
- t.Fatalf("%q not seen", ken)
+ if !seenUTF8 {
+ t.Fatalf("%q not seen", utf8)
}
}