mirror of
https://github.com/rjNemo/underscore
synced 2026-06-06 10:36:43 +00:00
18 lines
282 B
Go
18 lines
282 B
Go
package underscore_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
u "github.com/rjNemo/underscore"
|
|
)
|
|
|
|
func TestMap(t *testing.T) {
|
|
nums := []int{1, 2, 3}
|
|
f := func(n int) int {
|
|
return n * n
|
|
}
|
|
want := []int{1, 4, 9}
|
|
assert.Equal(t, want, u.Map(nums, f))
|
|
}
|