Resolve pipeline settings and collection selections
This commit is contained in:
@@ -76,3 +76,33 @@ func TestPrepareProcessInitializesReportsAndToleratesDebugLoss(t *testing.T) {
|
||||
t.Fatalf("output published early: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCollectionFlagJSON(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
raw string
|
||||
valid bool
|
||||
null bool
|
||||
size int
|
||||
}{
|
||||
{`["party","spells"]`, true, false, 2}, {`[]`, true, false, 0}, {`null`, true, true, 0},
|
||||
{`"party"`, false, false, 0}, {`[1]`, false, false, 0}, {`["x"] true`, false, false, 0},
|
||||
} {
|
||||
result, err := parseCollectionNames(tc.raw)
|
||||
if (err == nil) != tc.valid {
|
||||
t.Fatalf("%s error=%v", tc.raw, err)
|
||||
}
|
||||
if !tc.valid {
|
||||
continue
|
||||
}
|
||||
if tc.null {
|
||||
if result != nil {
|
||||
t.Fatalf("null=%v", result)
|
||||
}
|
||||
continue
|
||||
}
|
||||
list, ok := result.([]any)
|
||||
if !ok || len(list) != tc.size {
|
||||
t.Fatalf("%s result=%v", tc.raw, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user