aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/path/filepath/path_windows_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/path/filepath/path_windows_test.go')
-rw-r--r--src/pkg/path/filepath/path_windows_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pkg/path/filepath/path_windows_test.go b/src/pkg/path/filepath/path_windows_test.go
index 8a9be8e896..100cf30a45 100644
--- a/src/pkg/path/filepath/path_windows_test.go
+++ b/src/pkg/path/filepath/path_windows_test.go
@@ -10,9 +10,29 @@ import (
"os/exec"
"path/filepath"
"reflect"
+ "syscall"
"testing"
)
+func init() {
+ tmpdir, err := ioutil.TempDir("", "symtest")
+ if err != nil {
+ panic("failed to create temp directory: " + err.Error())
+ }
+ defer os.RemoveAll(tmpdir)
+
+ err = os.Symlink("target", filepath.Join(tmpdir, "symlink"))
+ if err == nil {
+ return
+ }
+
+ err = err.(*os.LinkError).Err
+ switch err {
+ case syscall.EWINDOWS, syscall.ERROR_PRIVILEGE_NOT_HELD:
+ supportsSymlinks = false
+ }
+}
+
func TestWinSplitListTestsAreValid(t *testing.T) {
comspec := os.Getenv("ComSpec")
if comspec == "" {