Skip to content

Commit

Permalink
function/stdlib: Even more Distinct tests
Browse files Browse the repository at this point in the history
  • Loading branch information
apparentlymart committed Oct 13, 2024
1 parent b843884 commit 7313684
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cty/function/stdlib/collection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2855,6 +2855,12 @@ func TestDistinct(t *testing.T) {
cty.ListValEmpty(cty.Number),
"",
},
// Empty list (unknown element type)
{
cty.ListValEmpty(cty.DynamicPseudoType),
cty.ListValEmpty(cty.DynamicPseudoType),
"",
},
// List with single element
{
cty.ListVal([]cty.Value{
Expand Down Expand Up @@ -2917,6 +2923,12 @@ func TestDistinct(t *testing.T) {
}),
"",
},
// Wholly-unknown list
{
cty.UnknownVal(cty.List(cty.String)),
cty.UnknownVal(cty.List(cty.String)).RefineNotNull(),
"",
},
// List with unknown values
{
cty.ListVal([]cty.Value{
Expand All @@ -2928,6 +2940,12 @@ func TestDistinct(t *testing.T) {
cty.UnknownVal(cty.List(cty.String)).RefineNotNull(),
"",
},
// null list
{
cty.NullVal(cty.List(cty.String)),
cty.NilVal,
"argument must not be null",
},
// List with null values
{
cty.ListVal([]cty.Value{
Expand Down

0 comments on commit 7313684

Please sign in to comment.