summaryrefslogtreecommitdiff
path: root/tests/typ/code/ops.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-03-15 15:27:36 +0100
committerLaurenz <laurmaedje@gmail.com>2022-03-15 15:27:36 +0100
commit77d153d315a2a5909840ebcd47491e4cef14428b (patch)
tree0886afd2ac4b03facb7c33a4e59924e30f55fd41 /tests/typ/code/ops.typ
parentae0a56cdffa515ed6bb7cb566c025cc66ff00f33 (diff)
Add `in` and `not in` operators
Diffstat (limited to 'tests/typ/code/ops.typ')
-rw-r--r--tests/typ/code/ops.typ21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/typ/code/ops.typ b/tests/typ/code/ops.typ
index b81fc841..899ee71c 100644
--- a/tests/typ/code/ops.typ
+++ b/tests/typ/code/ops.typ
@@ -165,7 +165,26 @@
{ x += "thing" } #test(x, "something")
---
-// Test with operator.
+// Test `in` operator.
+#test("hi" in "worship", true)
+#test("hi" in ("we", "hi", "bye"), true)
+#test("Hey" in "abHeyCd", true)
+#test("Hey" in "abheyCd", false)
+#test(5 in range(10), true)
+#test(12 in range(10), false)
+#test("" in (), false)
+#test("key" in (key: "value"), true)
+#test("value" in (key: "value"), false)
+#test("Hey" not in "abheyCd", true)
+#test("a" not
+/* fun comment? */ in "abc", false)
+
+---
+// Error: 9 expected keyword `in`
+{"a" not}
+
+---
+// Test `with` operator.
// Apply positional arguments.
#let add(x, y) = x + y