Add test for TypeMap in a Schema

This commit is contained in:
James Bardin 2016-06-09 16:00:33 -04:00
parent d8fbaa7924
commit bab031aac5
1 changed files with 25 additions and 1 deletions

View File

@ -13,7 +13,6 @@ func TestSerializeForHash(t *testing.T) {
}
tests := []testCase{
testCase{
Schema: &Schema{
Type: TypeInt,
@ -193,6 +192,31 @@ func TestSerializeForHash(t *testing.T) {
},
Expected: "green:1;name:my-fun-database;size:12;",
},
// test TypeMap nested in Schema: GH-7091
testCase{
Schema: &Resource{
Schema: map[string]*Schema{
"outer": &Schema{
Type: TypeSet,
Required: true,
Elem: &Schema{
Type: TypeMap,
Optional: true,
},
},
},
},
Value: map[string]interface{}{
"outer": NewSet(func(i interface{}) int { return 42 }, []interface{}{
map[string]interface{}{
"foo": "bar",
"baz": "foo",
},
}),
},
Expected: "outer:{[baz:foo;foo:bar;];};",
},
}
for _, test := range tests {