diff options
Diffstat (limited to 'tests/cli/cli_test.go')
-rw-r--r-- | tests/cli/cli_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go index 24bb029..8808742 100644 --- a/tests/cli/cli_test.go +++ b/tests/cli/cli_test.go @@ -448,3 +448,15 @@ func TestMultipleOperationFlags(t *testing.T) { } } } + +// Test that a missing argument to "-o" triggers exit code 1. +// See also cli_args_test.go for comprehensive tests of "-o" parsing. +func TestMissingOArg(t *testing.T) { + cmd := exec.Command(test_helpers.GocryptfsBinary, "foo", "bar", "-o") + err := cmd.Run() + exitCode := test_helpers.ExtractCmdExitCode(err) + if exitCode != exitcodes.Usage { + t.Fatalf("this should have failed with code %d, but returned %d", + exitcodes.Usage, exitCode) + } +} |