github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/scanners/azure/functions/guid_test.go (about) 1 package functions 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/require" 7 ) 8 9 func Test_Guid(t *testing.T) { 10 tests := []struct { 11 name string 12 args []interface{} 13 expected string 14 }{ 15 { 16 name: "guid from a string", 17 args: []interface{}{ 18 "hello", 19 }, 20 expected: "2cf24dba-5fb0-430e-a6e8-3b2ac5b9e29e", 21 }, 22 { 23 name: "guid from an string", 24 args: []interface{}{}, 25 expected: "", 26 }, 27 } 28 29 for _, tt := range tests { 30 t.Run(tt.name, func(t *testing.T) { 31 guid := Guid(tt.args...) 32 require.Equal(t, tt.expected, guid) 33 }) 34 } 35 }