|
83 | 83 | "expression": "avg(strings)", |
84 | 84 | "error": "invalid-type" |
85 | 85 | }, |
| 86 | + { |
| 87 | + "expression": "avg(empty_list)", |
| 88 | + "result": null |
| 89 | + }, |
86 | 90 | { |
87 | 91 | "expression": "ceil(`1.2`)", |
88 | 92 | "result": 2 |
|
175 | 179 | "expression": "length('abc')", |
176 | 180 | "result": 3 |
177 | 181 | }, |
| 182 | + { |
| 183 | + "expression": "length('✓foo')", |
| 184 | + "result": 4 |
| 185 | + }, |
178 | 186 | { |
179 | 187 | "expression": "length('')", |
180 | 188 | "result": 0 |
|
568 | 576 | "error": "invalid-arity" |
569 | 577 | }, |
570 | 578 | { |
571 | | - "description": "function projection on single arg function", |
| 579 | + "comment": "function projection on single arg function", |
572 | 580 | "expression": "numbers[].to_string(@)", |
573 | 581 | "result": ["-1", "3", "4", "5"] |
574 | 582 | }, |
575 | 583 | { |
576 | | - "description": "function projection on single arg function", |
| 584 | + "comment": "function projection on single arg function", |
577 | 585 | "expression": "array[].to_number(@)", |
578 | 586 | "result": [-1, 3, 4, 5, 100] |
579 | 587 | } |
|
591 | 599 | }, |
592 | 600 | "cases": [ |
593 | 601 | { |
594 | | - "description": "function projection on variadic function", |
| 602 | + "comment": "function projection on variadic function", |
595 | 603 | "expression": "foo[].not_null(f, e, d, c, b, a)", |
596 | 604 | "result": ["b", "c", "d", "e", "f"] |
597 | 605 | } |
|
609 | 617 | }, |
610 | 618 | "cases": [ |
611 | 619 | { |
612 | | - "description": "sort by field expression", |
| 620 | + "comment": "sort by field expression", |
613 | 621 | "expression": "sort_by(people, &age)", |
614 | 622 | "result": [ |
615 | 623 | {"age": 10, "age_str": "10", "bool": true, "name": 3}, |
|
630 | 638 | ] |
631 | 639 | }, |
632 | 640 | { |
633 | | - "description": "sort by function expression", |
| 641 | + "comment": "sort by function expression", |
634 | 642 | "expression": "sort_by(people, &to_number(age_str))", |
635 | 643 | "result": [ |
636 | 644 | {"age": 10, "age_str": "10", "bool": true, "name": 3}, |
|
641 | 649 | ] |
642 | 650 | }, |
643 | 651 | { |
644 | | - "description": "function projection on sort_by function", |
| 652 | + "comment": "function projection on sort_by function", |
645 | 653 | "expression": "sort_by(people, &age)[].name", |
646 | 654 | "result": [3, "a", "c", "b", "d"] |
647 | 655 | }, |
|
689 | 697 | "expression": "max_by(people, &to_number(age_str))", |
690 | 698 | "result": {"age": 50, "age_str": "50", "bool": false, "name": "d"} |
691 | 699 | }, |
| 700 | + { |
| 701 | + "expression": "max_by(`[]`, &age)", |
| 702 | + "result": null |
| 703 | + }, |
692 | 704 | { |
693 | 705 | "expression": "min_by(people, &age)", |
694 | 706 | "result": {"age": 10, "age_str": "10", "bool": true, "name": 3} |
|
708 | 720 | { |
709 | 721 | "expression": "min_by(people, &to_number(age_str))", |
710 | 722 | "result": {"age": 10, "age_str": "10", "bool": true, "name": 3} |
| 723 | + }, |
| 724 | + { |
| 725 | + "expression": "min_by(`[]`, &age)", |
| 726 | + "result": null |
711 | 727 | } |
712 | 728 | ] |
713 | 729 | }, { |
|
729 | 745 | }, |
730 | 746 | "cases": [ |
731 | 747 | { |
732 | | - "description": "stable sort order", |
| 748 | + "comment": "stable sort order", |
733 | 749 | "expression": "sort_by(people, &age)", |
734 | 750 | "result": [ |
735 | 751 | {"age": 10, "order": "1"}, |
|
0 commit comments