summaryrefslogtreecommitdiff
path: root/tests/typ/compiler/array.typ
diff options
context:
space:
mode:
Diffstat (limited to 'tests/typ/compiler/array.typ')
-rw-r--r--tests/typ/compiler/array.typ20
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), ())