aboutsummaryrefslogtreecommitdiff
path: root/src/path/filepath/path_test.go
diff options
context:
space:
mode:
authorHiroshi Ioka <hirochachacha@gmail.com>2016-08-18 18:40:02 +0900
committerBrad Fitzpatrick <bradfitz@golang.org>2016-10-12 14:01:03 +0000
commitb65cdc28882bfd7c4be46e811a6a7841d9fb7d53 (patch)
treee90fb71092fc61fd0001f12a54c1e46fa78a7fa0 /src/path/filepath/path_test.go
parent6e759ad2e2ae53f08db4470aa60e972eb908f2ef (diff)
downloadgo-b65cdc28882bfd7c4be46e811a6a7841d9fb7d53.tar.xz
path/filepath: add a test case for EvalSymlinks error
EvalSymlinks returns error if given path or its target path don't exist. Add a test for future improvement. Change-Id: Ic9a4aa5eaee0fe7ac523d54d8eb3132a11b380b3 Reviewed-on: https://go-review.googlesource.com/27330 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/path/filepath/path_test.go')
-rw-r--r--src/path/filepath/path_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go
index 737db6c93a..e319e3c973 100644
--- a/src/path/filepath/path_test.go
+++ b/src/path/filepath/path_test.go
@@ -962,6 +962,28 @@ func TestEvalSymlinks(t *testing.T) {
}
}
+func TestEvalSymlinksIsNotExist(t *testing.T) {
+ testenv.MustHaveSymlink(t)
+
+ defer chtmpdir(t)()
+
+ _, err := filepath.EvalSymlinks("notexist")
+ if !os.IsNotExist(err) {
+ t.Errorf("expected the file is not found, got %v\n", err)
+ }
+
+ err = os.Symlink("notexist", "link")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer os.Remove("link")
+
+ _, err = filepath.EvalSymlinks("link")
+ if !os.IsNotExist(err) {
+ t.Errorf("expected the file is not found, got %v\n", err)
+ }
+}
+
func TestIssue13582(t *testing.T) {
testenv.MustHaveSymlink(t)