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