mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
helper/schema: more tests
This commit is contained in:
parent
dd00001c9a
commit
e4f0f6b15d
@ -22,6 +22,19 @@ func TestMapFieldWriter(t *testing.T) {
|
|||||||
Type: TypeList,
|
Type: TypeList,
|
||||||
Elem: &Schema{Type: TypeInt},
|
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},
|
"map": &Schema{Type: TypeMap},
|
||||||
"set": &Schema{
|
"set": &Schema{
|
||||||
Type: TypeSet,
|
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": {
|
"list of strings": {
|
||||||
[]string{"list"},
|
[]string{"list"},
|
||||||
[]interface{}{"foo", "bar"},
|
[]interface{}{"foo", "bar"},
|
||||||
|
Loading…
Reference in New Issue
Block a user