Commit 35770118 authored by Aaron Jacobs's avatar Aaron Jacobs

MemFSTest.ReadLink_NotASymlink

parent 4537a6fb
......@@ -1187,5 +1187,25 @@ func (t *MemFSTest) ReadLink_NonExistent() {
}
func (t *MemFSTest) ReadLink_NotASymlink() {
AssertTrue(false, "TODO")
var err error
// Create a file and a directory.
fileName := path.Join(t.Dir, "foo")
err = ioutil.WriteFile(fileName, []byte{}, 0400)
AssertEq(nil, err)
dirName := path.Join(t.Dir, "bar")
err = os.Mkdir(dirName, 0700)
AssertEq(nil, err)
// Reading either of them as a symlink should fail.
names := []string{
fileName,
dirName,
}
for _, n := range names {
_, err = os.Readlink(n)
ExpectThat(err, Error(HasSubstr("invalid argument")))
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment