github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/arrays/remove_values_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 TestRemoveValues(t *testing.T) {
    14  	Convey("Should return a copy of an array without given elements", t, func() {
    15  		arr := values.NewArrayWith(
    16  			values.NewInt(1),
    17  			values.NewInt(2),
    18  			values.NewInt(3),
    19  			values.NewInt(4),
    20  			values.NewInt(5),
    21  			values.NewInt(6),
    22  		)
    23  
    24  		out, err := arrays.RemoveValues(
    25  			context.Background(),
    26  			arr,
    27  			values.NewArrayWith(
    28  				values.NewInt(3),
    29  				values.NewInt(5),
    30  				values.NewInt(6),
    31  			),
    32  		)
    33  
    34  		So(err, ShouldBeNil)
    35  		So(out.String(), ShouldEqual, "[1,2,4]")
    36  	})
    37  }