summaryrefslogtreecommitdiff
path: root/tests/typ/control/for-pattern.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-02-20 17:53:40 +0100
committerLaurenz <laurmaedje@gmail.com>2021-02-20 23:34:33 +0100
commit05727bfc3a9cfd45a8e2028dfd0806f7a8f88015 (patch)
tree6c0b66eb2a9dff224cb39eb6ccb478656a706c04 /tests/typ/control/for-pattern.typ
parent927341d93ae29678095e3b874bd68bfc57d4bc05 (diff)
Reorganize tests 🔀
Diffstat (limited to 'tests/typ/control/for-pattern.typ')
-rw-r--r--tests/typ/control/for-pattern.typ30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/typ/control/for-pattern.typ b/tests/typ/control/for-pattern.typ
new file mode 100644
index 00000000..38253b33
--- /dev/null
+++ b/tests/typ/control/for-pattern.typ
@@ -0,0 +1,30 @@
+// Test for loop patterns.
+// Ref: false
+
+---
+#let out = ()
+
+// Values of array.
+#for v in (1, 2, 3) {
+ out += (v,)
+}
+
+// Values of dictionary.
+#for v in (a: 4, b: 5) {
+ out += (v,)
+}
+
+// Keys and values of dictionary.
+#for k, v in (a: 6, b: 7) {
+ out += (k,)
+ out += (v,)
+}
+
+#test(out, (1, 2, 3, 4, 5, "a", 6, "b", 7))
+
+---
+// Keys and values of array.
+// Error: 6-10 mismatched pattern
+#for k, v in (-1, -2, -3) {
+ dont-care
+}