github.com/grahambrereton-form3/tilt@v0.10.18/internal/sliceutils/sliceutils_test.go (about) 1 package sliceutils 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestAppendWithoutDupesNoDupes(t *testing.T) { 10 a := []string{"a", "b"} 11 b := []string{"c", "d"} 12 observed := AppendWithoutDupes(a, b...) 13 expected := []string{"a", "b", "c", "d"} 14 assert.Equal(t, expected, observed) 15 } 16 17 func TestAppendWithoutDupesHasADupe(t *testing.T) { 18 a := []string{"a", "b"} 19 b := []string{"c", "b"} 20 observed := AppendWithoutDupes(a, b...) 21 expected := []string{"a", "b", "c"} 22 assert.Equal(t, expected, observed) 23 } 24 25 func TestAppendWithoutDupesEmptyA(t *testing.T) { 26 a := []string{} 27 b := []string{"c", "b"} 28 observed := AppendWithoutDupes(a, b...) 29 expected := []string{"c", "b"} 30 assert.Equal(t, expected, observed) 31 } 32 33 func TestAppendWithoutDupesEmptyB(t *testing.T) { 34 a := []string{"a", "b"} 35 b := []string{} 36 observed := AppendWithoutDupes(a, b...) 37 expected := []string{"a", "b"} 38 assert.Equal(t, expected, observed) 39 }