...

Source file src/github.com/thoas/go-funk/without_test.go

Documentation: github.com/thoas/go-funk

     1  package funk
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestWithout(t *testing.T) {
    11  	testCases := []struct {
    12  		Arr    interface{}
    13  		Values []interface{}
    14  		Expect interface{}
    15  	}{
    16  		{[]string{"foo", "bar"}, []interface{}{"bar"}, []string{"foo"}},
    17  		{[]int{0, 1, 2, 3, 4}, []interface{}{3, 4}, []int{0, 1, 2}},
    18  		{[]*Foo{f, b}, []interface{}{b, c}, []*Foo{f}},
    19  	}
    20  
    21  	for idx, tt := range testCases {
    22  		t.Run(fmt.Sprintf("test case #%d", idx+1), func(t *testing.T) {
    23  			is := assert.New(t)
    24  
    25  			actual := Without(tt.Arr, tt.Values...)
    26  			is.Equal(tt.Expect, actual)
    27  		})
    28  	}
    29  }
    30  

View as plain text