github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/arrays/unique_test.go (about) 1 package arrays_test 2 3 import ( 4 "context" 5 "testing" 6 7 . "github.com/smartystreets/goconvey/convey" 8 9 "github.com/MontFerret/ferret/pkg/runtime/values" 10 "github.com/MontFerret/ferret/pkg/stdlib/arrays" 11 ) 12 13 func TestUnique(t *testing.T) { 14 Convey("Should return only unique items", t, func() { 15 arr := values.NewArrayWith( 16 values.NewInt(1), 17 values.NewInt(2), 18 values.NewInt(2), 19 values.NewInt(3), 20 values.NewInt(4), 21 values.NewInt(3), 22 values.NewInt(5), 23 values.NewInt(6), 24 values.NewInt(5), 25 values.NewInt(6), 26 ) 27 28 res, err := arrays.Unique( 29 context.Background(), 30 arr, 31 ) 32 33 So(err, ShouldBeNil) 34 35 So(res.String(), ShouldEqual, `[1,2,3,4,5,6]`) 36 }) 37 }