lang/funcs: Pass through empty list in chunklist
This commit is contained in:
parent
e39fa55a6f
commit
736fda1613
|
@ -392,6 +392,10 @@ var ChunklistFunc = function.New(&function.Spec{
|
||||||
return cty.UnknownVal(retType), nil
|
return cty.UnknownVal(retType), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if listVal.LengthInt() == 0 {
|
||||||
|
return cty.ListValEmpty(listVal.Type()), nil
|
||||||
|
}
|
||||||
|
|
||||||
var size int
|
var size int
|
||||||
err = gocty.FromCtyValue(args[1], &size)
|
err = gocty.FromCtyValue(args[1], &size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1087,6 +1087,12 @@ func TestChunklist(t *testing.T) {
|
||||||
cty.UnknownVal(cty.List(cty.List(cty.String))),
|
cty.UnknownVal(cty.List(cty.List(cty.String))),
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
cty.ListValEmpty(cty.String),
|
||||||
|
cty.NumberIntVal(3),
|
||||||
|
cty.ListValEmpty(cty.List(cty.String)),
|
||||||
|
false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
|
|
Loading…
Reference in New Issue