github.com/raghuse92/packer@v1.3.2/packer/telemetry_test.go (about) 1 package packer 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestFlattenConfigKeys_nil(t *testing.T) { 10 f := flattenConfigKeys(nil) 11 assert.Zero(t, f, "Expected empty list.") 12 } 13 14 func TestFlattenConfigKeys_nested(t *testing.T) { 15 inp := make(map[string]interface{}) 16 inp["A"] = "" 17 inp["B"] = []string{} 18 19 c := make(map[string]interface{}) 20 c["X"] = "" 21 d := make(map[string]interface{}) 22 d["a"] = "" 23 24 c["Y"] = d 25 inp["C"] = c 26 27 assert.Equal(t, 28 []string{"A", "B", "C/X", "C/Y/a"}, 29 flattenConfigKeys(inp), 30 "Input didn't flatten correctly.", 31 ) 32 }