mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
typeexpr: More optional modifier tests
Ensuring that the constraint boolean carries through to the next level of constraint calculation after an optional() modifier.
This commit is contained in:
parent
dde4979c49
commit
c82e291422
@ -257,6 +257,15 @@ func TestGetType(t *testing.T) {
|
|||||||
}, []string{"age"}),
|
}, []string{"age"}),
|
||||||
``,
|
``,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
`object({name=string,meta=optional(any)})`,
|
||||||
|
true,
|
||||||
|
cty.ObjectWithOptionalAttrs(map[string]cty.Type{
|
||||||
|
"name": cty.String,
|
||||||
|
"meta": cty.DynamicPseudoType,
|
||||||
|
}, []string{"meta"}),
|
||||||
|
``,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
`object({name=string,age=optional(number)})`,
|
`object({name=string,age=optional(number)})`,
|
||||||
false,
|
false,
|
||||||
@ -266,6 +275,15 @@ func TestGetType(t *testing.T) {
|
|||||||
}),
|
}),
|
||||||
`Optional attribute modifier is only for type constraints, not for exact types.`,
|
`Optional attribute modifier is only for type constraints, not for exact types.`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
`object({name=string,meta=optional(any)})`,
|
||||||
|
false,
|
||||||
|
cty.Object(map[string]cty.Type{
|
||||||
|
"name": cty.String,
|
||||||
|
"meta": cty.DynamicPseudoType,
|
||||||
|
}),
|
||||||
|
`Optional attribute modifier is only for type constraints, not for exact types.`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
`optional(string)`,
|
`optional(string)`,
|
||||||
false,
|
false,
|
||||||
|
Loading…
Reference in New Issue
Block a user