github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/internal/examples/loopexamples/loop_Conv_test.go (about) 1 package loopexamples 2 3 import ( 4 "strconv" 5 "testing" 6 7 "github.com/stretchr/testify/assert" 8 9 "github.com/m4gshm/gollections/loop" 10 ) 11 12 func Test_Conv(t *testing.T) { 13 14 result, err := loop.Conv(loop.Of("1", "3", "5", "_7", "9", "11"), strconv.Atoi).Slice() 15 //[]int{1, 3, 5}, ErrSyntax 16 17 assert.Equal(t, []int{1, 3, 5}, result) 18 assert.ErrorIs(t, err, strconv.ErrSyntax) 19 }