...

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

Documentation: github.com/thoas/go-funk

     1  package funk
     2  
     3  import (
     4  	"testing"
     5  	"github.com/stretchr/testify/assert"
     6  )
     7  
     8  func TestSubset(t *testing.T) {
     9  	is := assert.New(t)
    10  
    11  	r := Subset([]int{1, 2, 4}, []int{1, 2, 3, 4, 5})
    12  	is.True(r)
    13  
    14  	r = Subset([]string{"foo", "bar"},[]string{"foo", "bar", "hello", "bar", "hi"})
    15  	is.True(r)
    16  
    17  	r = Subset([]string{"foo", "bar","extra"},[]string{"foo", "bar", "hello", "bar", "hi"})
    18  	is.False(r)
    19  
    20  	r = Subset([]string{"hello", "foo", "bar", "hello", "bar", "hi"}, []string{})
    21  	is.False(r)
    22    
    23          r = Subset([]string{}, []string{"hello", "foo", "bar", "hello", "bar", "hi"})
    24  	is.True(r)
    25  
    26  	r = Subset([]string{}, []string{})
    27  	is.True(r)
    28  
    29  	r = Subset([]string{}, []string{"hello"})
    30  	is.True(r)
    31  
    32  	r = Subset([]string{"hello", "foo", "bar", "hello", "bar", "hi"}, []string{"foo", "bar"} )
    33  	is.False(r)
    34  }
    35  

View as plain text