mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-02 11:30:23 +00:00
Remove empty strings from slice before parsing agent config (#3387)
Fixes: https://github.com/woodpecker-ci/woodpecker/issues/3385
This commit is contained in:
@@ -68,3 +68,24 @@ func TestSliceToBoolMap(t *testing.T) {
|
||||
assert.Equal(t, map[string]bool{}, SliceToBoolMap([]string{}))
|
||||
assert.Equal(t, map[string]bool{}, SliceToBoolMap([]string{""}))
|
||||
}
|
||||
|
||||
func TestStringSliceDeleteEmpty(t *testing.T) {
|
||||
tests := []struct {
|
||||
in []string
|
||||
out []string
|
||||
}{{
|
||||
in: []string{"", "ab", "ab"},
|
||||
out: []string{"ab", "ab"},
|
||||
}, {
|
||||
in: []string{"", "ab", ""},
|
||||
out: []string{"ab"},
|
||||
}, {
|
||||
in: []string{""},
|
||||
out: []string{},
|
||||
}}
|
||||
|
||||
for _, tc := range tests {
|
||||
exp := StringSliceDeleteEmpty(tc.in)
|
||||
assert.EqualValues(t, tc.out, exp, "got '%#v', expects %#v", exp, tc.out)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user