Skip to content

Commit

Permalink
tests: helpers: fix a few error reports
Browse files Browse the repository at this point in the history
These were using stale err values.
  • Loading branch information
rfjakob committed Apr 27, 2018
1 parent 12b32aa commit 996d2f1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/test_helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,10 @@ func TestMkdirRmdir(t *testing.T, plainDir string) {
t.Error(err)
return
}
// Removing a non-empty dir should fail with ENOTEMPTY
if os.Mkdir(dir, 0777) != nil {
// Create a directory and put a file in it
// Trying to rmdir it should fail with ENOTEMPTY
err = os.Mkdir(dir, 0777)
if err != nil {
t.Error(err)
return
}
Expand All @@ -308,13 +310,15 @@ func TestMkdirRmdir(t *testing.T, plainDir string) {
err = syscall.Rmdir(dir)
errno := err.(syscall.Errno)
if errno != syscall.ENOTEMPTY {
t.Errorf("Should have gotten ENOTEMPTY, go %v", errno)
t.Errorf("Should have gotten ENOTEMPTY, got %v", errno)
}
if syscall.Unlink(dir+"/file") != nil {
err = syscall.Unlink(dir + "/file")
if err != nil {
t.Error(err)
return
}
if syscall.Rmdir(dir) != nil {
err = syscall.Rmdir(dir)
if err != nil {
t.Error(err)
return
}
Expand Down

0 comments on commit 996d2f1

Please sign in to comment.