mirror of
https://github.com/golang/go
synced 2024-11-11 19:31:37 -07:00
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>
This commit is contained in:
parent
9ece9a7ac9
commit
c1bc44642d
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user