Skip to content

Commit c1bc446

Browse files
Bryan C. Millsgopherbot
Bryan C. Mills
authored andcommitted
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 <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Bryan Mills <[email protected]>
1 parent 9ece9a7 commit c1bc446

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

src/path/filepath/path_test.go

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,36 +1622,33 @@ func TestBug3486(t *testing.T) { // https://golang.org/issue/3486
16221622
if runtime.GOOS == "ios" {
16231623
t.Skipf("skipping on %s/%s", runtime.GOOS, runtime.GOARCH)
16241624
}
1625-
root, err := filepath.EvalSymlinks(testenv.GOROOT(t) + "/test")
1626-
if err != nil {
1627-
t.Fatal(err)
1628-
}
1629-
bugs := filepath.Join(root, "fixedbugs")
1630-
ken := filepath.Join(root, "ken")
1631-
seenBugs := false
1632-
seenKen := false
1633-
err = filepath.Walk(root, func(pth string, info fs.FileInfo, err error) error {
1625+
root := filepath.Join(testenv.GOROOT(t), "src", "unicode")
1626+
utf16 := filepath.Join(root, "utf16")
1627+
utf8 := filepath.Join(root, "utf8")
1628+
seenUTF16 := false
1629+
seenUTF8 := false
1630+
err := filepath.Walk(root, func(pth string, info fs.FileInfo, err error) error {
16341631
if err != nil {
16351632
t.Fatal(err)
16361633
}
16371634

16381635
switch pth {
1639-
case bugs:
1640-
seenBugs = true
1636+
case utf16:
1637+
seenUTF16 = true
16411638
return filepath.SkipDir
1642-
case ken:
1643-
if !seenBugs {
1644-
t.Fatal("filepath.Walk out of order - ken before fixedbugs")
1639+
case utf8:
1640+
if !seenUTF16 {
1641+
t.Fatal("filepath.Walk out of order - utf8 before utf16")
16451642
}
1646-
seenKen = true
1643+
seenUTF8 = true
16471644
}
16481645
return nil
16491646
})
16501647
if err != nil {
16511648
t.Fatal(err)
16521649
}
1653-
if !seenKen {
1654-
t.Fatalf("%q not seen", ken)
1650+
if !seenUTF8 {
1651+
t.Fatalf("%q not seen", utf8)
16551652
}
16561653
}
16571654

0 commit comments

Comments
 (0)