zclsyntax: test some more cases of unknowns in "for"
This commit is contained in:
parent
1ef7d6f6de
commit
b625d4b90e
@ -529,6 +529,22 @@ upper(
|
||||
}),
|
||||
0,
|
||||
},
|
||||
{
|
||||
`{for i, v in ["a", "b", "c", "b", "d"]: v => i... if i <= 2}`,
|
||||
nil,
|
||||
cty.ObjectVal(map[string]cty.Value{
|
||||
"a": cty.TupleVal([]cty.Value{
|
||||
cty.NumberIntVal(0),
|
||||
}),
|
||||
"b": cty.TupleVal([]cty.Value{
|
||||
cty.NumberIntVal(1),
|
||||
}),
|
||||
"c": cty.TupleVal([]cty.Value{
|
||||
cty.NumberIntVal(2),
|
||||
}),
|
||||
}),
|
||||
0,
|
||||
},
|
||||
{
|
||||
`{for i, v in ["a", "b", "c", "b", "d"]: v => i}`,
|
||||
nil,
|
||||
@ -590,6 +606,39 @@ upper(
|
||||
cty.DynamicVal,
|
||||
1, // can't iterate over a string (even if it's unknown)
|
||||
},
|
||||
{
|
||||
`[for v in ["a", "b"]: v if unk]`,
|
||||
&zcl.EvalContext{
|
||||
Variables: map[string]cty.Value{
|
||||
"unk": cty.UnknownVal(cty.Bool),
|
||||
},
|
||||
},
|
||||
cty.DynamicVal,
|
||||
0,
|
||||
},
|
||||
{
|
||||
`[for v in ["a", "b"]: v if unk]`,
|
||||
&zcl.EvalContext{
|
||||
Variables: map[string]cty.Value{
|
||||
"unk": cty.UnknownVal(cty.Number),
|
||||
},
|
||||
},
|
||||
cty.DynamicVal,
|
||||
0, // if expression must be bool
|
||||
},
|
||||
{
|
||||
`[for v in ["a", "b"]: unk]`,
|
||||
&zcl.EvalContext{
|
||||
Variables: map[string]cty.Value{
|
||||
"unk": cty.UnknownVal(cty.String),
|
||||
},
|
||||
},
|
||||
cty.TupleVal([]cty.Value{
|
||||
cty.UnknownVal(cty.String),
|
||||
cty.UnknownVal(cty.String),
|
||||
}),
|
||||
0,
|
||||
},
|
||||
|
||||
{
|
||||
`[{name: "Steve"}, {name: "Ermintrude"}].*.name`,
|
||||
|
Loading…
Reference in New Issue
Block a user