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
}
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) {