mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
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>
This commit is contained in:
parent
6e759ad2e2
commit
b65cdc2888
|
@ -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) {
|
func TestIssue13582(t *testing.T) {
|
||||||
testenv.MustHaveSymlink(t)
|
testenv.MustHaveSymlink(t)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue