MemFSTest.Rmdir_Empty
parent
19f7ef25c9
commit
baffc23ee6
|
@ -328,7 +328,32 @@ func (t *MemFSTest) Rmdir_NonEmpty() {
|
|||
}
|
||||
|
||||
func (t *MemFSTest) Rmdir_Empty() {
|
||||
AssertTrue(false, "TODO")
|
||||
var err error
|
||||
var entries []os.FileInfo
|
||||
|
||||
// Create two levels of directories.
|
||||
err = os.MkdirAll(path.Join(t.mfs.Dir(), "foo/bar"), 0754)
|
||||
AssertEq(nil, err)
|
||||
|
||||
// Remove the leaf.
|
||||
err = os.Remove(path.Join(t.mfs.Dir(), "foo/bar"))
|
||||
AssertEq(nil, err)
|
||||
|
||||
// There should be nothing left in the parent.
|
||||
entries, err = ioutil.ReadDir(path.Join(t.mfs.Dir(), "foo"))
|
||||
|
||||
AssertEq(nil, err)
|
||||
ExpectThat(entries, ElementsAre())
|
||||
|
||||
// Remove the parent.
|
||||
err = os.Remove(path.Join(t.mfs.Dir(), "foo"))
|
||||
AssertEq(nil, err)
|
||||
|
||||
// Now the root directory should be empty, too.
|
||||
entries, err = ioutil.ReadDir(t.mfs.Dir())
|
||||
|
||||
AssertEq(nil, err)
|
||||
ExpectThat(entries, ElementsAre())
|
||||
}
|
||||
|
||||
func (t *MemFSTest) Rmdir_NotADirectory() {
|
||||
|
|
Loading…
Reference in New Issue