github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/scanners/azure/functions/join_test.go (about) 1 package functions 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func Test_Join(t *testing.T) { 10 tests := []struct { 11 name string 12 args []interface{} 13 expected string 14 }{ 15 { 16 name: "join strings with no items", 17 args: []interface{}{ 18 []string{}, 19 " ", 20 }, 21 expected: "", 22 }, 23 { 24 name: "join strings", 25 args: []interface{}{ 26 []string{"Hello", "World"}, 27 " ", 28 }, 29 expected: "Hello World", 30 }, 31 } 32 33 for _, tt := range tests { 34 t.Run(tt.name, func(t *testing.T) { 35 actual := Join(tt.args...) 36 assert.Equal(t, tt.expected, actual) 37 }) 38 } 39 }