aboutsummaryrefslogtreecommitdiff
path: root/src/path/filepath/path_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/path/filepath/path_test.go')
-rw-r--r--src/path/filepath/path_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go
index 3434ea2e6e..1b9f286c4d 100644
--- a/src/path/filepath/path_test.go
+++ b/src/path/filepath/path_test.go
@@ -15,6 +15,7 @@ import (
"runtime"
"sort"
"strings"
+ "syscall"
"testing"
)
@@ -1371,3 +1372,39 @@ func TestWalkSymlink(t *testing.T) {
testenv.MustHaveSymlink(t)
testWalkSymlink(t, os.Symlink)
}
+
+func TestIssue29372(t *testing.T) {
+ f, err := ioutil.TempFile("", "issue29372")
+ if err != nil {
+ t.Fatal(err)
+ }
+ f.Close()
+ path := f.Name()
+ defer os.Remove(path)
+
+ isWin := runtime.GOOS == "windows"
+ pathSeparator := string(filepath.Separator)
+ tests := []struct {
+ path string
+ skip bool
+ }{
+ {path + strings.Repeat(pathSeparator, 1), false},
+ {path + strings.Repeat(pathSeparator, 2), false},
+ {path + strings.Repeat(pathSeparator, 1) + ".", false},
+ {path + strings.Repeat(pathSeparator, 2) + ".", false},
+ // windows.GetFinalPathNameByHandle return the directory part with trailing dot dot
+ // C:\path\to\existing_dir\existing_file\.. returns C:\path\to\existing_dir
+ {path + strings.Repeat(pathSeparator, 1) + "..", isWin},
+ {path + strings.Repeat(pathSeparator, 2) + "..", isWin},
+ }
+
+ for i, test := range tests {
+ if test.skip {
+ continue
+ }
+ _, err = filepath.EvalSymlinks(test.path)
+ if err != syscall.ENOTDIR {
+ t.Fatalf("test#%d: want %q, got %q", i, syscall.ENOTDIR, err)
+ }
+ }
+}