summaryrefslogtreecommitdiff
path: root/tests/suite/scripting/arguments.typ
diff options
context:
space:
mode:
authorMalo <57839069+MDLC01@users.noreply.github.com>2024-09-02 18:22:43 +0200
committerGitHub <noreply@github.com>2024-09-02 16:22:43 +0000
commit9fd796e0e24ef9a76f8f7328e0a1eed350e91320 (patch)
tree5bdd8023eed23a2bf71dbfa224b28800cb4ea306 /tests/suite/scripting/arguments.typ
parent1ccfaba88eac41211a74b334fe0401cc12e72969 (diff)
Add `at` method to `arguments` (#4864)
Diffstat (limited to 'tests/suite/scripting/arguments.typ')
-rw-r--r--tests/suite/scripting/arguments.typ18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/suite/scripting/arguments.typ b/tests/suite/scripting/arguments.typ
new file mode 100644
index 00000000..e82f4962
--- /dev/null
+++ b/tests/suite/scripting/arguments.typ
@@ -0,0 +1,18 @@
+// Test arguments.
+
+--- arguments-at ---
+#let args = arguments(0, 1, a: 2, 3)
+#test(args.at(0), 0)
+#test(args.at(1), 1)
+#test(args.at(2), 3)
+#test(args.at("a"), 2)
+
+--- arguments-at-invalid-index ---
+#let args = arguments(0, 1, a: 2, 3)
+// Error: 2-12 arguments do not contain key 4 and no default value was specified
+#args.at(4)
+
+--- arguments-at-invalid-name ---
+#let args = arguments(0, 1, a: 2, 3)
+// Error: 2-14 arguments do not contain key "b" and no default value was specified
+#args.at("b")