MemFSTest.RenameOverExisting_WrongType

geesefs-0-30-9
Aaron Jacobs 2015-06-25 21:57:17 +10:00
parent a28c3afdfd
commit 7fb4f4d34f
1 changed files with 17 additions and 1 deletions

View File

@ -1623,7 +1623,23 @@ func (t *MemFSTest) RenameOverExistingDirectory() {
}
func (t *MemFSTest) RenameOverExisting_WrongType() {
AssertTrue(false, "TODO")
var err error
// Create a file and a directory.
filePath := path.Join(t.Dir, "foo")
err = ioutil.WriteFile(filePath, []byte("taco"), 0400)
AssertEq(nil, err)
dirPath := path.Join(t.Dir, "bar")
err = os.Mkdir(dirPath, 0700)
AssertEq(nil, err)
// Renaming one over the other shouldn't work.
err = os.Rename(filePath, dirPath)
ExpectThat(err, Error(HasSubstr("is a directory")))
err = os.Rename(dirPath, filePath)
ExpectThat(err, Error(HasSubstr("not a directory")))
}
func (t *MemFSTest) RenameNonExistentFile() {