summaryrefslogtreecommitdiff
path: root/tests/typ/basics/enum.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-29 13:37:25 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-29 14:18:13 +0100
commit0efe669278a5e1c3f2985eba2f3360e91159c54a (patch)
tree502712857c48f0decb5e698257c0a96d358a436e /tests/typ/basics/enum.typ
parent836692e73cff0356e409a9ba5b4887b86809d4ca (diff)
Reorganize library and tests
Diffstat (limited to 'tests/typ/basics/enum.typ')
-rw-r--r--tests/typ/basics/enum.typ65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/typ/basics/enum.typ b/tests/typ/basics/enum.typ
new file mode 100644
index 00000000..d4c30385
--- /dev/null
+++ b/tests/typ/basics/enum.typ
@@ -0,0 +1,65 @@
+// Test enumerations.
+
+---
+#enum[Embrace][Extend][Extinguish]
+
+---
+1. First.
+ 2. Indented
+
++ Second
+
+---
+// Test automatic numbering in summed content.
+#for i in range(5) {
+ [+ #numbering(1 + i, "I")]
+}
+
+---
+// Test label pattern.
+#set enum(label: "~ A:")
+1. First
+ + Second
+
+#set enum(label: "(*)")
++ A
++ B
++ C
+
+#set enum(label: "i)")
++ A
++ B
+
+---
+// Mix of different lists
+- List
++ Enum
+/ Desc: List
+
+---
+// Test label closure.
+#enum(
+ start: 4,
+ spacing: 0.65em - 3pt,
+ tight: false,
+ label: n => text(fill: (red, green, blue)(mod(n, 3)), numbering(n, "A")),
+ [Red], [Green], [Blue],
+)
+
+---
+#set enum(label: n => n > 1)
++ A
++ B
+
+---
+// Lone plus is not an enum.
++
+No enum
+
+---
+// Error: 18-20 invalid numbering pattern
+#set enum(label: "")
+
+---
+// Error: 18-24 invalid numbering pattern
+#set enum(label: "(())")