helper/schema: more tests
This commit is contained in:
parent
dd00001c9a
commit
e4f0f6b15d
|
@ -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"},
|
||||
|
|
Loading…
Reference in New Issue