aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cli/cli_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go
index cce7fa0..905a890 100644
--- a/tests/cli/cli_test.go
+++ b/tests/cli/cli_test.go
@@ -10,6 +10,7 @@ import (
"testing"
"github.com/rfjakob/gocryptfs/internal/configfile"
+ "github.com/rfjakob/gocryptfs/internal/exitcodes"
"github.com/rfjakob/gocryptfs/tests/test_helpers"
)
@@ -316,3 +317,16 @@ func TestInitTrailingGarbage(t *testing.T) {
}
}
}
+
+// TestPasswordIncorrect makes sure the correct exit code is used when the password
+// was incorrect
+func TestPasswordIncorrect(t *testing.T) {
+ cDir := test_helpers.InitFS(t)
+ pDir := cDir + ".mnt"
+ err := test_helpers.Mount(cDir, pDir, false, "-extpass", "echo WRONG", "-wpanic=false")
+ // vvvvvvvvvvvvvv OMG vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+ exitCode := err.(*exec.ExitError).Sys().(syscall.WaitStatus).ExitStatus()
+ if exitCode != exitcodes.PasswordIncorrect {
+ t.Errorf("want=%d, got=%d", exitcodes.PasswordIncorrect, exitCode)
+ }
+}