aboutsummaryrefslogtreecommitdiff
path: root/tests/test_helpers/helpers.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-04-27 20:19:51 +0200
committerJakob Unterwurzacher2018-04-27 20:19:51 +0200
commit996d2f141b2c4f0cb9b8fbf66d06a2fb6e8cbaef (patch)
treea7e9ae79d7a403f3abbf8f100c93da341b45ea4d /tests/test_helpers/helpers.go
parent12b32aa06c0475d60ee51b3753052ac2e4d09308 (diff)
tests: helpers: fix a few error reports
These were using stale err values.
Diffstat (limited to 'tests/test_helpers/helpers.go')
-rw-r--r--tests/test_helpers/helpers.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/test_helpers/helpers.go b/tests/test_helpers/helpers.go
index 4c704d4..e7fcf4b 100644
--- a/tests/test_helpers/helpers.go
+++ b/tests/test_helpers/helpers.go
@@ -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
}
@@ -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
}