diff options
author | Jakob Unterwurzacher | 2017-04-29 15:11:17 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2017-04-29 15:11:17 +0200 |
commit | e135a72bda6ffa828e5445a16c349dd7017db282 (patch) | |
tree | 3637aa85f23a6431a014b3664394c437cd54650a /cli_args_test.go | |
parent | edb3e19cb5543c580261052395d461fa47c7cf58 (diff) |
main: "--" should also block "-o" parsing
Includes test cases.
Diffstat (limited to 'cli_args_test.go')
-rw-r--r-- | cli_args_test.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cli_args_test.go b/cli_args_test.go index 8846491..63a33ef 100644 --- a/cli_args_test.go +++ b/cli_args_test.go @@ -12,6 +12,7 @@ type testcase struct { o []string } +// TestPrefixOArgs checks that the "-o x,y,z" parsing works correctly. func TestPrefixOArgs(t *testing.T) { testcases := []testcase{ { @@ -51,6 +52,15 @@ func TestPrefixOArgs(t *testing.T) { i: []string{"gocryptfs", "-o", "rw", "--config", "fff", "ccc", "mmm"}, o: []string{"gocryptfs", "-rw", "--config", "fff", "ccc", "mmm"}, }, + // "--" should also block "-o" parsing. + { + i: []string{"gocryptfs", "foo", "bar", "--", "-o", "a"}, + o: []string{"gocryptfs", "foo", "bar", "--", "-o", "a"}, + }, + { + i: []string{"gocryptfs", "--", "-o", "a"}, + o: []string{"gocryptfs", "--", "-o", "a"}, + }, } for _, tc := range testcases { o := prefixOArgs(tc.i) |