diff options
| author | Malo <57839069+MDLC01@users.noreply.github.com> | 2025-04-02 11:41:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-02 09:41:45 +0000 |
| commit | 417f5846b68777b8a4d3b9336761bd23c48a26b5 (patch) | |
| tree | 55a9b9f968b5c70bb80f9964148f493d6f213918 /tests/suite | |
| parent | 12699eb7f415bdba6797c84e3e7bf44dde75bdf9 (diff) | |
Support comparison functions in `array.sorted` (#5627)
Co-authored-by: +merlan #flirora <uruwi@protonmail.com>
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'tests/suite')
| -rw-r--r-- | tests/suite/foundations/array.typ | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/suite/foundations/array.typ b/tests/suite/foundations/array.typ index 61b5decb..0c820d7f 100644 --- a/tests/suite/foundations/array.typ +++ b/tests/suite/foundations/array.typ @@ -359,6 +359,12 @@ #test((2, 1, 3, 10, 5, 8, 6, -7, 2).sorted(), (-7, 1, 2, 2, 3, 5, 6, 8, 10)) #test((2, 1, 3, -10, -5, 8, 6, -7, 2).sorted(key: x => x), (-10, -7, -5, 1, 2, 2, 3, 6, 8)) #test((2, 1, 3, -10, -5, 8, 6, -7, 2).sorted(key: x => x * x), (1, 2, 2, 3, -5, 6, -7, 8, -10)) +#test(("I", "the", "hi", "text").sorted(by: (x, y) => x.len() < y.len()), ("I", "hi", "the", "text")) +#test(("I", "the", "hi", "text").sorted(key: x => x.len(), by: (x, y) => y < x), ("text", "the", "hi", "I")) + +--- array-sorted-invalid-by-function --- +// Error: 2-39 expected boolean from `by` function, got string +#(1, 2, 3).sorted(by: (_, _) => "hmm") --- array-sorted-key-function-positional-1 --- // Error: 12-18 unexpected argument |
