Skip to content

Commit 7313684

Browse files
function/stdlib: Even more Distinct tests
1 parent b843884 commit 7313684

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

cty/function/stdlib/collection_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2855,6 +2855,12 @@ func TestDistinct(t *testing.T) {
28552855
cty.ListValEmpty(cty.Number),
28562856
"",
28572857
},
2858+
// Empty list (unknown element type)
2859+
{
2860+
cty.ListValEmpty(cty.DynamicPseudoType),
2861+
cty.ListValEmpty(cty.DynamicPseudoType),
2862+
"",
2863+
},
28582864
// List with single element
28592865
{
28602866
cty.ListVal([]cty.Value{
@@ -2917,6 +2923,12 @@ func TestDistinct(t *testing.T) {
29172923
}),
29182924
"",
29192925
},
2926+
// Wholly-unknown list
2927+
{
2928+
cty.UnknownVal(cty.List(cty.String)),
2929+
cty.UnknownVal(cty.List(cty.String)).RefineNotNull(),
2930+
"",
2931+
},
29202932
// List with unknown values
29212933
{
29222934
cty.ListVal([]cty.Value{
@@ -2928,6 +2940,12 @@ func TestDistinct(t *testing.T) {
29282940
cty.UnknownVal(cty.List(cty.String)).RefineNotNull(),
29292941
"",
29302942
},
2943+
// null list
2944+
{
2945+
cty.NullVal(cty.List(cty.String)),
2946+
cty.NilVal,
2947+
"argument must not be null",
2948+
},
29312949
// List with null values
29322950
{
29332951
cty.ListVal([]cty.Value{

0 commit comments

Comments
 (0)