woodpecker-docker-buildx/utils/lamda_test.go
2023-05-02 19:25:49 +00:00

19 lines
415 B
Go

package utils
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestMap(t *testing.T) {
ints := []int{1, 2, 3, 4}
ints = Map(ints, func(i int) int { return i * 10 })
assert.EqualValues(t, []int{10, 20, 30, 40}, ints)
sl := []string{"a ", "b", " c"}
sl = Map(sl, func(s string) string { return "#" + strings.TrimSpace(s) })
assert.EqualValues(t, []string{"#a", "#b", "#c"}, sl)
}