mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-22 12:26:35 +00:00
Add some tests (#3030)
This commit is contained in:
@@ -58,7 +58,7 @@ func sliceToCountMap[E comparable](list []E) map[E]int {
|
||||
return m
|
||||
}
|
||||
|
||||
// sliceToMap is a helper function to convert a string slice to a map.
|
||||
// SliceToBoolMap is a helper function to convert a string slice to a map.
|
||||
func SliceToBoolMap(s []string) map[string]bool {
|
||||
v := map[string]bool{}
|
||||
for _, ss := range s {
|
||||
|
@@ -58,3 +58,13 @@ func TestEqualSliceValues(t *testing.T) {
|
||||
assert.True(t, EqualSliceValues([]bool{true, false, false}, []bool{false, false, true}))
|
||||
assert.False(t, EqualSliceValues([]bool{true, false, false}, []bool{true, false, true}))
|
||||
}
|
||||
|
||||
func TestSliceToBoolMap(t *testing.T) {
|
||||
assert.Equal(t, map[string]bool{
|
||||
"a": true,
|
||||
"b": true,
|
||||
"c": true,
|
||||
}, SliceToBoolMap([]string{"a", "b", "c"}))
|
||||
assert.Equal(t, map[string]bool{}, SliceToBoolMap([]string{}))
|
||||
assert.Equal(t, map[string]bool{}, SliceToBoolMap([]string{""}))
|
||||
}
|
||||
|
Reference in New Issue
Block a user