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