aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/path/filepath/path_test.go
diff options
context:
space:
mode:
authorMichael Fraenkel <michael.fraenkel@gmail.com>2014-07-17 17:02:46 +1000
committerAlex Brainman <alex.brainman@gmail.com>2014-07-17 17:02:46 +1000
commitcf521ce64f50c4f300294d6b649f34eca87bb8a3 (patch)
treea7f4a5612448eae5076254bd2c2193dc87727b34 /src/pkg/path/filepath/path_test.go
parent47fd6bd9b62c8c028f03fc9407e3ce261fb8ed6d (diff)
downloadgo-cf521ce64f50c4f300294d6b649f34eca87bb8a3.tar.xz
os: Implement symlink support for Windows
Fixes #5750. https://code.google.com/p/go/issues/detail?id=5750 os: Separate windows from posix. Implement windows support. path/filepath: Use the same implementation as other platforms syscall: Add/rework new APIs for Windows LGTM=alex.brainman R=golang-codereviews, alex.brainman, gobot, rsc, minux CC=golang-codereviews https://golang.org/cl/86160044
Diffstat (limited to 'src/pkg/path/filepath/path_test.go')
-rw-r--r--src/pkg/path/filepath/path_test.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/pkg/path/filepath/path_test.go b/src/pkg/path/filepath/path_test.go
index 819bd217cc..17b53bdf92 100644
--- a/src/pkg/path/filepath/path_test.go
+++ b/src/pkg/path/filepath/path_test.go
@@ -15,6 +15,8 @@ import (
"testing"
)
+var supportsSymlinks = true
+
type PathTest struct {
path, result string
}
@@ -716,7 +718,7 @@ func TestEvalSymlinks(t *testing.T) {
if d.dest == "" {
err = os.Mkdir(path, 0755)
} else {
- if runtime.GOOS != "windows" {
+ if supportsSymlinks {
err = os.Symlink(d.dest, path)
}
}
@@ -726,7 +728,9 @@ func TestEvalSymlinks(t *testing.T) {
}
var tests []EvalSymlinksTest
- if runtime.GOOS == "windows" {
+ if supportsSymlinks {
+ tests = EvalSymlinksTests
+ } else {
for _, d := range EvalSymlinksTests {
if d.path == d.dest {
// will test only real files and directories
@@ -739,15 +743,13 @@ func TestEvalSymlinks(t *testing.T) {
tests = append(tests, d2)
}
}
- } else {
- tests = EvalSymlinksTests
}
// Evaluate the symlink farm.
for _, d := range tests {
path := simpleJoin(tmpDir, d.path)
dest := simpleJoin(tmpDir, d.dest)
- if filepath.IsAbs(d.dest) {
+ if filepath.IsAbs(d.dest) || os.IsPathSeparator(d.dest[0]) {
dest = d.dest
}
if p, err := filepath.EvalSymlinks(path); err != nil {