aboutsummaryrefslogtreecommitdiff
path: root/src/path/filepath/path_windows_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/path/filepath/path_windows_test.go')
-rw-r--r--src/path/filepath/path_windows_test.go32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/path/filepath/path_windows_test.go b/src/path/filepath/path_windows_test.go
index 63eab18116..3fcccfab78 100644
--- a/src/path/filepath/path_windows_test.go
+++ b/src/path/filepath/path_windows_test.go
@@ -536,17 +536,39 @@ func TestNTNamespaceSymlink(t *testing.T) {
}
target := strings.Trim(string(output), " \n\r")
- link := filepath.Join(tmpdir, "link")
- output, err = exec.Command("cmd", "/c", "mklink", "/J", link, target).CombinedOutput()
+ dirlink := filepath.Join(tmpdir, "dirlink")
+ output, err = exec.Command("cmd", "/c", "mklink", "/J", dirlink, target).CombinedOutput()
if err != nil {
- t.Fatalf("failed to run mklink %v %v: %v %q", link, target, err, output)
+ t.Fatalf("failed to run mklink %v %v: %v %q", dirlink, target, err, output)
}
- got, err := filepath.EvalSymlinks(link)
+ got, err := filepath.EvalSymlinks(dirlink)
if err != nil {
t.Fatal(err)
}
if want := vol + `\`; got != want {
- t.Errorf(`EvalSymlinks(%q): got %q, want %q`, link, got, want)
+ t.Errorf(`EvalSymlinks(%q): got %q, want %q`, dirlink, got, want)
+ }
+
+ file := filepath.Join(tmpdir, "file")
+ err = ioutil.WriteFile(file, []byte(""), 0666)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ target += file[len(filepath.VolumeName(file)):]
+
+ filelink := filepath.Join(tmpdir, "filelink")
+ output, err = exec.Command("cmd", "/c", "mklink", filelink, target).CombinedOutput()
+ if err != nil {
+ t.Fatalf("failed to run mklink %v %v: %v %q", filelink, target, err, output)
+ }
+
+ got, err = filepath.EvalSymlinks(filelink)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if want := file; got != want {
+ t.Errorf(`EvalSymlinks(%q): got %q, want %q`, filelink, got, want)
}
}