github.com/databricks/cli@v0.203.0/libs/filer/slice_test.go (about)

     1  package filer
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestSliceWithout(t *testing.T) {
    10  	assert.Equal(t, []int{}, sliceWithout([]int{}, 0))
    11  	assert.Equal(t, []int{1, 2, 3}, sliceWithout([]int{1, 2, 3}, 4))
    12  	assert.Equal(t, []int{2, 3}, sliceWithout([]int{1, 2, 3}, 1))
    13  	assert.Equal(t, []int{1, 3}, sliceWithout([]int{1, 2, 3}, 2))
    14  	assert.Equal(t, []int{1, 2}, sliceWithout([]int{1, 2, 3}, 3))
    15  
    16  }
    17  
    18  func TestSliceWithoutReturnsClone(t *testing.T) {
    19  	var ints = []int{1, 2, 3}
    20  	assert.Equal(t, []int{2, 3}, sliceWithout(ints, 1))
    21  	assert.Equal(t, []int{1, 2, 3}, ints)
    22  }