mirror of
https://github.com/rjNemo/underscore
synced 2026-06-06 10:36:43 +00:00
23 lines
416 B
Go
23 lines
416 B
Go
package underscore_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
u "github.com/rjNemo/underscore"
|
|
)
|
|
|
|
func TestSome(t *testing.T) {
|
|
nums := []int{1, 2, 4, 6, 8}
|
|
isOdd := func(n int) bool { return n%2 != 0 }
|
|
|
|
assert.True(t, u.Any(nums, isOdd))
|
|
}
|
|
|
|
func TestNotSome(t *testing.T) {
|
|
nums := []int{2, 4, 6, 8}
|
|
isOdd := func(n int) bool { return n%2 != 0 }
|
|
|
|
assert.False(t, u.Any(nums, isOdd))
|
|
}
|