summaryrefslogtreecommitdiff
path: root/cli_args_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-10-10 19:44:34 +0200
committerJakob Unterwurzacher2016-10-10 19:44:34 +0200
commit7b2049c7698325a6a0ef965b6fb7a2fa94e3329b (patch)
treec07aecad09a6f3b137f584428224db2548513f50 /cli_args_test.go
parent828f7184838be17d04ff4d78d8b066f4947406f3 (diff)
main: accept "-o" at the front AND at the end
Moving "-o" to the end broke a third-party app, SiriKali. Breaking your users is bad, so let's accept "-o" anywhere.
Diffstat (limited to 'cli_args_test.go')
-rw-r--r--cli_args_test.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/cli_args_test.go b/cli_args_test.go
index 844a0b1..e1ed435 100644
--- a/cli_args_test.go
+++ b/cli_args_test.go
@@ -39,14 +39,23 @@ func TestPrefixOArgs(t *testing.T) {
o: []string{"gocryptfs", "-a", "-b", "-xxxxx", "foo", "bar"},
},
testcase{
+ i: []string{"gocryptfs", "foo", "bar", "-d", "-o=a,b,xxxxx"},
+ o: []string{"gocryptfs", "-a", "-b", "-xxxxx", "foo", "bar", "-d"},
+ },
+ testcase{
i: []string{"gocryptfs", "foo", "bar", "-oooo", "a,b,xxxxx"},
o: []string{"gocryptfs", "foo", "bar", "-oooo", "a,b,xxxxx"},
},
+ // https://github.com/mhogomchungu/sirikali/blob/a36d91d3e39f0c1eb9a79680ed6c28ddb6568fa8/src/siritask.cpp#L192
+ testcase{
+ i: []string{"gocryptfs", "-o", "rw", "--config", "fff", "ccc", "mmm"},
+ o: []string{"gocryptfs", "-rw", "--config", "fff", "ccc", "mmm"},
+ },
}
for _, tc := range testcases {
o := prefixOArgs(tc.i)
if !reflect.DeepEqual(o, tc.o) {
- t.Errorf("\n i=%q\nwant=%q\n got=%q", tc.i, tc.o, o)
+ t.Errorf("\n in=%q\nwant=%q\n got=%q", tc.i, tc.o, o)
}
}
}