Add tests for nested structues in flatmap.Expand

This commit is contained in:
James Bardin 2016-12-16 16:33:39 -05:00
parent 084670c241
commit c7f5d8b7e7
1 changed files with 37 additions and 0 deletions

View File

@ -69,6 +69,43 @@ func TestExpand(t *testing.T) {
},
},
},
{
Map: map[string]string{
"list_of_map.#": "2",
"list_of_map.0.%": "1",
"list_of_map.0.a": "1",
"list_of_map.1.%": "2",
"list_of_map.1.b": "2",
"list_of_map.1.c": "3",
},
Key: "list_of_map",
Output: []interface{}{
map[string]interface{}{
"a": "1",
},
map[string]interface{}{
"b": "2",
"c": "3",
},
},
},
{
Map: map[string]string{
"map_of_list.%": "2",
"map_of_list.list2.#": "1",
"map_of_list.list2.0": "c",
"map_of_list.list1.#": "2",
"map_of_list.list1.0": "a",
"map_of_list.list1.1": "b",
},
Key: "map_of_list",
Output: map[string]interface{}{
"list1": []interface{}{"a", "b"},
"list2": []interface{}{"c"},
},
},
}
for _, tc := range cases {