summaryrefslogtreecommitdiff
path: root/tests/typ/elements/enum.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-02-28 15:50:48 +0100
committerLaurenz <laurmaedje@gmail.com>2022-02-28 23:54:34 +0100
commit3ca5b238238e1128aa7bbfbd5db9e632045d8600 (patch)
tree2471f4b340a15695b7f4d518c0b39fabaea676c4 /tests/typ/elements/enum.typ
parentb63c21c91d99a1554a019dc275f955d3e6a34271 (diff)
Reorganize library
Diffstat (limited to 'tests/typ/elements/enum.typ')
-rw-r--r--tests/typ/elements/enum.typ60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/typ/elements/enum.typ b/tests/typ/elements/enum.typ
new file mode 100644
index 00000000..8ba3cea6
--- /dev/null
+++ b/tests/typ/elements/enum.typ
@@ -0,0 +1,60 @@
+// Test enums.
+
+---
+. Embrace
+. Extend
+. Extinguish
+
+---
+1. First.
+ 2. Second.
+
+1. Back to first.
+
+---
+2. Second
+1. First
+ . Indented
+
+---
+// Test automatic numbering in summed templates.
+#for i in range(5) {
+ [. #roman(1 + i)]
+}
+
+---
+// Test label pattern.
+#set enum(label: "~ A:")
+. First
+. Second
+
+#set enum(label: "(*)")
+. A
+. B
+. C
+
+#set enum(label: "i)")
+. A
+. B
+
+---
+// Test label closure.
+#enum(
+ start: 4,
+ spacing: -3pt,
+ label: n => text(fill: (red, green, blue)(mod(n, 3)), [#upper(letter(n))]),
+ [Red], [Green], [Blue],
+)
+
+---
+// Error: 18-20 invalid pattern
+#set enum(label: "")
+
+---
+// Error: 18-24 invalid pattern
+#set enum(label: "(())")
+
+---
+// Error: 18-28 expected template, found boolean
+#set enum(label: n => false)
+. A