aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/path/filepath/path_test.go
diff options
context:
space:
mode:
authorAlex Brainman <alex.brainman@gmail.com>2014-08-22 17:14:42 +1000
committerAlex Brainman <alex.brainman@gmail.com>2014-08-22 17:14:42 +1000
commite6f0b746677fbca7b5dbeeb1777cc13b81a31918 (patch)
tree6460164ed06b693070b58fb534171912b5ec2434 /src/pkg/path/filepath/path_test.go
parent67812a7cd90c22d9b121f747ad27c4f527767ad5 (diff)
downloadgo-e6f0b746677fbca7b5dbeeb1777cc13b81a31918.tar.xz
path/filepath: make Abs handle paths like c:a.txt properly
Fixes #8145. LGTM=r R=golang-codereviews, r CC=golang-codereviews https://golang.org/cl/126440043
Diffstat (limited to 'src/pkg/path/filepath/path_test.go')
-rw-r--r--src/pkg/path/filepath/path_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pkg/path/filepath/path_test.go b/src/pkg/path/filepath/path_test.go
index 8cdc763f1b..399284b97d 100644
--- a/src/pkg/path/filepath/path_test.go
+++ b/src/pkg/path/filepath/path_test.go
@@ -628,6 +628,8 @@ var winisabstests = []IsAbsTest{
{`\`, false},
{`\Windows`, false},
{`c:a\b`, false},
+ {`c:\a\b`, true},
+ {`c:/a/b`, true},
{`\\host\share\foo`, true},
{`//host/share/foo/bar`, true},
}
@@ -807,6 +809,19 @@ func TestAbs(t *testing.T) {
}
}
+ if runtime.GOOS == "windows" {
+ vol := filepath.VolumeName(root)
+ var extra []string
+ for _, path := range absTests {
+ if strings.Index(path, "$") != -1 {
+ continue
+ }
+ path = vol + path
+ extra = append(extra, path)
+ }
+ absTests = append(absTests, extra...)
+ }
+
err = os.Chdir(absTestDirs[0])
if err != nil {
t.Fatal("chdir failed: ", err)