Commit 005e43cd authored by Aaron Jacobs's avatar Aaron Jacobs

MemFSTest.UnlinkFile_Exists

parent 52f2e5fe
......@@ -540,7 +540,27 @@ func (t *MemFSTest) ModifyExistingFile_InSubDir() {
}
func (t *MemFSTest) UnlinkFile_Exists() {
AssertTrue(false, "TODO")
var err error
// Write a file.
fileName := path.Join(t.mfs.Dir(), "foo")
err = ioutil.WriteFile(fileName, []byte("Jello, world!"), 0600)
AssertEq(nil, err)
// Unlink it.
err = os.Remove(fileName)
AssertEq(nil, err)
// Statting it should fail.
_, err = os.Stat(fileName)
AssertNe(nil, err)
ExpectThat(err, Error(HasSubstr("no such file")))
// Nothing should be in the directory.
entries, err := ioutil.ReadDir(t.mfs.Dir())
AssertEq(nil, err)
ExpectThat(entries, ElementsAre())
}
func (t *MemFSTest) UnlinkFile_NotAFile() {
......
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