aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-10-06 22:41:13 +0200
committerJakob Unterwurzacher2016-10-06 22:41:13 +0200
commit434ce50db38e78f7e2a67af07cb92d8829fdfdf6 (patch)
tree33315121c236268e4c10b7df9ccf98d931d5f606 /tests
parentff48dc1aab1c551dcaaa0f46b32dbc5f35e90e2e (diff)
main: add "-nonempty" option
Diffstat (limited to 'tests')
-rw-r--r--tests/normal/cli_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/normal/cli_test.go b/tests/normal/cli_test.go
index f0e160d..6691822 100644
--- a/tests/normal/cli_test.go
+++ b/tests/normal/cli_test.go
@@ -3,6 +3,7 @@ package normal
// Test CLI operations like "-init", "-password" etc
import (
+ "io/ioutil"
"os"
"os/exec"
"testing"
@@ -146,3 +147,24 @@ func TestRo(t *testing.T) {
t.Errorf("Create should have failed")
}
}
+
+// Test "-nonempty"
+func TestNonempty(t *testing.T) {
+ dir := test_helpers.InitFS(t)
+ mnt := dir + ".mnt"
+ err := os.Mkdir(mnt, 0700)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = ioutil.WriteFile(mnt+"/somefile", []byte("xyz"), 0600)
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = test_helpers.Mount(dir, mnt, false, "-extpass=echo test")
+ if err == nil {
+ t.Errorf("Mounting over a file should fail per default")
+ }
+ // Should work with "-nonempty"
+ test_helpers.MountOrFatal(t, dir, mnt, "-nonempty", "-extpass=echo test")
+ test_helpers.UnmountPanic(mnt)
+}