tests: TestParseCliOpts: de-uglify testcase list

This commit is contained in:
Jakob Unterwurzacher 2023-05-03 20:56:36 +02:00
parent feb23c5d58
commit 6c14d25d44

View File

@ -131,48 +131,46 @@ func TestParseCliOpts(t *testing.T) {
o argContainer o argContainer
} }
var testcases []testcaseContainer testcases := []testcaseContainer{
{
testcases = append(testcases, testcaseContainer{ i: []string{"gocryptfs"},
i: []string{"gocryptfs"}, o: defaultArgs,
o: defaultArgs, },
}) }
o := defaultArgs o := defaultArgs
o.quiet = true o.quiet = true
testcases = append(testcases, testcaseContainer{ testcases = append(testcases, []testcaseContainer{
i: []string{"gocryptfs", "-q"}, {
o: o, i: []string{"gocryptfs", "-q"},
}) o: o,
testcases = append(testcases, testcaseContainer{ }, {
i: []string{"gocryptfs", "--q"}, i: []string{"gocryptfs", "--q"},
o: o, o: o,
}) }, {
testcases = append(testcases, testcaseContainer{ i: []string{"gocryptfs", "-quiet"},
i: []string{"gocryptfs", "-quiet"}, o: o,
o: o, }, {
}) i: []string{"gocryptfs", "--quiet"},
testcases = append(testcases, testcaseContainer{ o: o,
i: []string{"gocryptfs", "--quiet"}, },
o: o, }...)
})
o = defaultArgs o = defaultArgs
o.exclude = []string{"foo", "bar"} o.exclude = []string{"foo", "bar"}
testcases = append(testcases, testcaseContainer{ testcases = append(testcases, []testcaseContainer{
i: []string{"gocryptfs", "-e", "foo", "-e", "bar"}, {
o: o, i: []string{"gocryptfs", "-e", "foo", "-e", "bar"},
}) o: o,
testcases = append(testcases, testcaseContainer{ }, {
i: []string{"gocryptfs", "--exclude", "foo", "--exclude", "bar"}, i: []string{"gocryptfs", "--exclude", "foo", "--exclude", "bar"},
o: o, o: o,
}) }, /* TODO BROKEN {
/* TODO BROKEN i: []string{"gocryptfs", "--exclude", "foo", "-e", "bar"},
testcases = append(testcases, testcaseContainer{ o: o,
i: []string{"gocryptfs", "--exclude", "foo", "-e", "bar"}, },*/
o: o, }...)
})
*/
for _, tc := range testcases { for _, tc := range testcases {
o := parseCliOpts(tc.i) o := parseCliOpts(tc.i)
if !reflect.DeepEqual(o, tc.o) { if !reflect.DeepEqual(o, tc.o) {