summaryrefslogtreecommitdiff
path: root/tests/typ/code/closure.typ
diff options
context:
space:
mode:
Diffstat (limited to 'tests/typ/code/closure.typ')
-rw-r--r--tests/typ/code/closure.typ14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/typ/code/closure.typ b/tests/typ/code/closure.typ
index 1bc369e9..3b8b4261 100644
--- a/tests/typ/code/closure.typ
+++ b/tests/typ/code/closure.typ
@@ -83,3 +83,17 @@
// Error: 8-13 unexpected argument
f(1, "two", () => x)
}
+
+---
+// Named arguments.
+{
+ let greet(name, birthday: false) = {
+ if birthday { "Happy Birthday, " } else { "Hey, " } + name + "!"
+ }
+
+ test(greet("Typst"), "Hey, Typst!")
+ test(greet("Typst", birthday: true), "Happy Birthday, Typst!")
+
+ // Error: 23-35 unexpected argument
+ test(greet("Typst", whatever: 10))
+}