diff options
| author | frozolotl <44589151+frozolotl@users.noreply.github.com> | 2024-03-04 10:03:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-04 09:03:35 +0000 |
| commit | 879bd1a1cef506514123703f8031a8c203a2c0eb (patch) | |
| tree | d03cb31e446db4f57fdeffaca85585f9752d06fe /tests/typ/compiler/array.typ | |
| parent | 086bca9576d4faa05f48283462a883cbd585a69f (diff) | |
Add `chunks` method to array (#3539)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'tests/typ/compiler/array.typ')
| -rw-r--r-- | tests/typ/compiler/array.typ | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/typ/compiler/array.typ b/tests/typ/compiler/array.typ index 9ff29480..4a1948ff 100644 --- a/tests/typ/compiler/array.typ +++ b/tests/typ/compiler/array.typ @@ -237,6 +237,26 @@ #test((1, 2, "b").intersperse("a"), (1, "a", 2, "a", "b")) --- +// Test the `chunks` method. +#test(().chunks(10), ()) +#test((1, 2, 3).chunks(10), ((1, 2, 3),)) +#test((1, 2, 3, 4, 5, 6).chunks(3), ((1, 2, 3), (4, 5, 6))) +#test((1, 2, 3, 4, 5, 6, 7, 8).chunks(3), ((1, 2, 3), (4, 5, 6), (7, 8))) + +#test(().chunks(10, exact: true), ()) +#test((1, 2, 3).chunks(10, exact: true), ()) +#test((1, 2, 3, 4, 5, 6).chunks(3, exact: true), ((1, 2, 3), (4, 5, 6))) +#test((1, 2, 3, 4, 5, 6, 7, 8).chunks(3, exact: true), ((1, 2, 3), (4, 5, 6))) + +--- +// Error: 19-20 number must be positive +#(1, 2, 3).chunks(0) + +--- +// Error: 19-21 number must be positive +#(1, 2, 3).chunks(-5) + +--- // Test the `sorted` method. #test(().sorted(), ()) #test(().sorted(key: x => x), ()) |
