]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: fix TestShadowingLogic fails when GOROOT path has spaces
authorChristopher Nelson <nadiasvertex@gmail.com>
Tue, 15 Mar 2016 13:14:22 +0000 (09:14 -0400)
committerAlex Brainman <alex.brainman@gmail.com>
Fri, 18 Mar 2016 01:12:06 +0000 (01:12 +0000)
Improve the test by also translating " " to "_".

Fixes #14671.

Change-Id: Ie5997934b93c7663d7b8432244fad47bb5d3ffbe
Reviewed-on: https://go-review.googlesource.com/20714
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/go/go_test.go

index 5526aec8f937bb7437d306a1a82e269d8eff4e34..e663907e266478cb2a9f6c8a953536be7b22b67d 100644 (file)
@@ -1870,7 +1870,9 @@ func TestShadowingLogic(t *testing.T) {
        }
        // The output will have makeImportValid applies, but we only
        // bother to deal with characters we might reasonably see.
-       pwdForwardSlash = strings.Replace(pwdForwardSlash, ":", "_", -1)
+       for _, r := range " :" {
+               pwdForwardSlash = strings.Replace(pwdForwardSlash, string(r), "_", -1)
+       }
        want := "(_" + pwdForwardSlash + "/testdata/shadow/root1/src/math) (" + filepath.Join(runtime.GOROOT(), "src", "math") + ")"
        if strings.TrimSpace(tg.getStdout()) != want {
                t.Error("shadowed math is not shadowed; looking for", want)