Skip to content

Commit 50c15d1

Browse files
committed
Add test for empty array with sort_by
1 parent f23b196 commit 50c15d1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/compliance/functions.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@
609609
},
610610
"cases": [
611611
{
612-
"description": "function projection on variadic function",
612+
"description": "sort by field expression",
613613
"expression": "sort_by(people, &age)",
614614
"result": [
615615
{"age": 10, "age_str": "10", "bool": true, "name": 3},
@@ -620,7 +620,7 @@
620620
]
621621
},
622622
{
623-
"description": "function projection on variadic function",
623+
"description": "sort by function expression",
624624
"expression": "sort_by(people, &to_number(age_str))",
625625
"result": [
626626
{"age": 10, "age_str": "10", "bool": true, "name": 3},
@@ -631,7 +631,7 @@
631631
]
632632
},
633633
{
634-
"description": "function projection on variadic function",
634+
"description": "function projection on sort_by function",
635635
"expression": "sort_by(people, &age)[].name",
636636
"result": [3, "a", "c", "b", "d"]
637637
},
@@ -655,6 +655,10 @@
655655
"expression": "sort_by(people, &age)[].extra",
656656
"result": ["foo", "bar"]
657657
},
658+
{
659+
"expression": "sort_by(`[]`, &age)",
660+
"result": []
661+
},
658662
{
659663
"expression": "max_by(people, &age)",
660664
"result": {"age": 50, "age_str": "50", "bool": false, "name": "d"}

0 commit comments

Comments
 (0)