summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2023-05-03 20:56:36 +0200
committerJakob Unterwurzacher2023-05-03 20:56:36 +0200
commit6c14d25d442a819bf37e228d936e6a2a05de747d (patch)
tree2a6ec4f1a6553d0aee41f3d280bf43f903768592
parentfeb23c5d5893fa3c036beb97434e3b35e9e685a7 (diff)
tests: TestParseCliOpts: de-uglify testcase list
-rw-r--r--cli_args_test.go70
1 files changed, 34 insertions, 36 deletions
diff --git a/cli_args_test.go b/cli_args_test.go
index 74255f2..3220196 100644
--- a/cli_args_test.go
+++ b/cli_args_test.go
@@ -131,48 +131,46 @@ func TestParseCliOpts(t *testing.T) {
o argContainer
}
- var testcases []testcaseContainer
-
- testcases = append(testcases, testcaseContainer{
- i: []string{"gocryptfs"},
- o: defaultArgs,
- })
+ testcases := []testcaseContainer{
+ {
+ i: []string{"gocryptfs"},
+ o: defaultArgs,
+ },
+ }
o := defaultArgs
o.quiet = true
- testcases = append(testcases, testcaseContainer{
- i: []string{"gocryptfs", "-q"},
- o: o,
- })
- testcases = append(testcases, testcaseContainer{
- i: []string{"gocryptfs", "--q"},
- o: o,
- })
- testcases = append(testcases, testcaseContainer{
- i: []string{"gocryptfs", "-quiet"},
- o: o,
- })
- testcases = append(testcases, testcaseContainer{
- i: []string{"gocryptfs", "--quiet"},
- o: o,
- })
+ testcases = append(testcases, []testcaseContainer{
+ {
+ i: []string{"gocryptfs", "-q"},
+ o: o,
+ }, {
+ i: []string{"gocryptfs", "--q"},
+ o: o,
+ }, {
+ i: []string{"gocryptfs", "-quiet"},
+ o: o,
+ }, {
+ i: []string{"gocryptfs", "--quiet"},
+ o: o,
+ },
+ }...)
o = defaultArgs
o.exclude = []string{"foo", "bar"}
- testcases = append(testcases, testcaseContainer{
- i: []string{"gocryptfs", "-e", "foo", "-e", "bar"},
- o: o,
- })
- testcases = append(testcases, testcaseContainer{
- i: []string{"gocryptfs", "--exclude", "foo", "--exclude", "bar"},
- o: o,
- })
- /* TODO BROKEN
- testcases = append(testcases, testcaseContainer{
- i: []string{"gocryptfs", "--exclude", "foo", "-e", "bar"},
- o: o,
- })
- */
+ testcases = append(testcases, []testcaseContainer{
+ {
+ i: []string{"gocryptfs", "-e", "foo", "-e", "bar"},
+ o: o,
+ }, {
+ i: []string{"gocryptfs", "--exclude", "foo", "--exclude", "bar"},
+ o: o,
+ }, /* TODO BROKEN {
+ i: []string{"gocryptfs", "--exclude", "foo", "-e", "bar"},
+ o: o,
+ },*/
+ }...)
+
for _, tc := range testcases {
o := parseCliOpts(tc.i)
if !reflect.DeepEqual(o, tc.o) {