diff options
| author | Alex Brainman <alex.brainman@gmail.com> | 2019-01-05 18:35:27 +1100 |
|---|---|---|
| committer | Alex Brainman <alex.brainman@gmail.com> | 2019-01-10 08:35:34 +0000 |
| commit | 44cf595a7efcd3d7048c745d1d1531696bcb5941 (patch) | |
| tree | 05f200532f0950ece15d871efea5cfb7927dc3c2 /src/path/filepath/path_test.go | |
| parent | 94d9a2045398b471c8aec0b701cad06536e049b3 (diff) | |
| download | go-44cf595a7efcd3d7048c745d1d1531696bcb5941.tar.xz | |
path/filepath: return special error from EvalSymlinks
CL 155597 attempted to fix #29372. But it failed to make all new
test cases pass. Also CL 155597 broke some existing code
(see #29449 for details).
Make small adjustment to CL 155597 that fixes both #29372 and #29449.
Suggested by Ian.
Updates #29372
Fixes #29449
Change-Id: I9777a615514d3f152af5acb65fb1239e696607b6
Reviewed-on: https://go-review.googlesource.com/c/156398
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/path/filepath/path_test.go')
| -rw-r--r-- | src/path/filepath/path_test.go | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go index 1b9f286c4d..cbddda88b6 100644 --- a/src/path/filepath/path_test.go +++ b/src/path/filepath/path_test.go @@ -1382,27 +1382,18 @@ func TestIssue29372(t *testing.T) { 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}, + tests := []string{ + path + strings.Repeat(pathSeparator, 1), + path + strings.Repeat(pathSeparator, 2), + path + strings.Repeat(pathSeparator, 1) + ".", + path + strings.Repeat(pathSeparator, 2) + ".", + path + strings.Repeat(pathSeparator, 1) + "..", + path + strings.Repeat(pathSeparator, 2) + "..", } for i, test := range tests { - if test.skip { - continue - } - _, err = filepath.EvalSymlinks(test.path) + _, err = filepath.EvalSymlinks(test) if err != syscall.ENOTDIR { t.Fatalf("test#%d: want %q, got %q", i, syscall.ENOTDIR, err) } |
