test for decoding structures within lists

This commit is contained in:
Mitchell Hashimoto 2015-11-07 16:48:38 -08:00
parent 15fce08259
commit 338eebdbf7
2 changed files with 46 additions and 1 deletions

View File

@ -178,7 +178,7 @@ func TestDecode_interface(t *testing.T) {
"foo": []map[string]interface{}{
map[string]interface{}{
"name": "terraform_example",
"ingress": []interface{}{
"ingress": []map[string]interface{}{
map[string]interface{}{
"from_port": 22,
},
@ -206,6 +206,36 @@ func TestDecode_interface(t *testing.T) {
true,
nil,
},
{
"object_list.json",
false,
map[string]interface{}{
"resource": []map[string]interface{}{
map[string]interface{}{
"aws_instance": []map[string]interface{}{
map[string]interface{}{
"db": []map[string]interface{}{
map[string]interface{}{
"vpc": "foo",
"provisioner": []map[string]interface{}{
map[string]interface{}{
"file": []map[string]interface{}{
map[string]interface{}{
"source": "foo",
"destination": "bar",
},
},
},
},
},
},
},
},
},
},
},
},
}
for _, tc := range cases {

View File

@ -0,0 +1,15 @@
{
"resource": {
"aws_instance": {
"db": {
"vpc": "foo",
"provisioner": [{
"file": {
"source": "foo",
"destination": "bar"
}
}]
}
}
}
}