mirror of
https://github.com/samber/lo.git
synced 2025-10-05 07:56:51 +08:00
21 lines
300 B
Go
21 lines
300 B
Go
package lo
|
|
|
|
import (
|
|
"strconv"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestPartial(t *testing.T) {
|
|
t.Parallel()
|
|
is := assert.New(t)
|
|
|
|
add := func(x float64, y int) string {
|
|
return strconv.Itoa(int(x) + y)
|
|
}
|
|
f := Partial(add, 5)
|
|
is.Equal("15", f(10))
|
|
is.Equal("0", f(-5))
|
|
}
|