From 77d153d315a2a5909840ebcd47491e4cef14428b Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 15 Mar 2022 15:27:36 +0100 Subject: Add `in` and `not in` operators --- tests/typ/code/ops.typ | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'tests/typ') 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 -- cgit v1.2.3