Initial commit of modash
This was taken from github.com/lmika/gopkgs/fp
This commit is contained in:
commit
a20530ddfd
20 changed files with 425 additions and 0 deletions
25
moslice/find_test.go
Normal file
25
moslice/find_test.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package moslice_test
|
||||
|
||||
import (
|
||||
"lmika.dev/pkg/modash/moslice"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestContains(t *testing.T) {
|
||||
var (
|
||||
ints = []int{1, 2, 3}
|
||||
strs = []string{"a", "b", "c"}
|
||||
)
|
||||
|
||||
t.Run("should find items in the slice", func(t *testing.T) {
|
||||
assert.True(t, moslice.Contains(ints, 2))
|
||||
assert.True(t, moslice.Contains(strs, "c"))
|
||||
})
|
||||
|
||||
t.Run("should return false if items not in slice", func(t *testing.T) {
|
||||
assert.False(t, moslice.Contains(ints, 131))
|
||||
assert.False(t, moslice.Contains(strs, "bla"))
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue