github.com/aquasecurity/trivy-iac@v0.8.1-0.20240127024015-3d8e412cf0ab/pkg/scanners/azure/functions/unique_string_test.go (about) 1 package functions 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func Test_UniqueString(t *testing.T) { 10 tests := []struct { 11 name string 12 args []interface{} 13 expected string 14 }{ 15 { 16 name: "unique string from a string", 17 args: []interface{}{ 18 "hello", 19 }, 20 expected: "68656c6c6fe3b", 21 }, 22 { 23 name: "unique string from a string", 24 args: []interface{}{ 25 "hello", 26 "world", 27 }, 28 expected: "68656c6c6f776", 29 }, 30 } 31 32 for _, tt := range tests { 33 t.Run(tt.name, func(t *testing.T) { 34 actual := UniqueString(tt.args...) 35 assert.Equal(t, tt.expected, actual) 36 }) 37 } 38 }