helper/schema: more tests

This commit is contained in:
Mitchell Hashimoto 2015-02-18 14:44:46 -08:00
parent dd00001c9a
commit e4f0f6b15d
1 changed files with 36 additions and 0 deletions

View File

@ -22,6 +22,19 @@ func TestMapFieldWriter(t *testing.T) {
Type: TypeList,
Elem: &Schema{Type: TypeInt},
},
"listResource": &Schema{
Type: TypeList,
Optional: true,
Computed: true,
Elem: &Resource{
Schema: map[string]*Schema{
"value": &Schema{
Type: TypeInt,
Optional: true,
},
},
},
},
"map": &Schema{Type: TypeMap},
"set": &Schema{
Type: TypeSet,
@ -84,6 +97,29 @@ func TestMapFieldWriter(t *testing.T) {
},
},
"list of resources": {
[]string{"listResource"},
[]interface{}{
map[string]interface{}{
"value": 80,
},
},
false,
map[string]string{
"listResource.#": "1",
"listResource.0.value": "80",
},
},
"list of resources empty": {
[]string{"listResource"},
[]interface{}{},
false,
map[string]string{
"listResource.#": "0",
},
},
"list of strings": {
[]string{"list"},
[]interface{}{"foo", "bar"},