37718ded77
Reviewed-on: https://codeberg.org/woodpecker-plugins/docker-buildx/pulls/62 Reviewed-by: qwerty287 <qwerty287@noreply.codeberg.org>
19 lines
415 B
Go
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)
|
|
}
|