summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-07-18 21:53:42 +0200
committerLaurenz <laurmaedje@gmail.com>2023-07-18 21:53:42 +0200
commit803ae9309f54eaffff1340a81d06ede1969e26b1 (patch)
treee6be076653f4760982c98a8be040d801fb1f327d /tests
parentf52c39c388c2e3e38be0022fda6d78b12f0a9544 (diff)
Support `scope` argument for `eval`
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/compute/foundations.pngbin0 -> 2344 bytes
-rw-r--r--tests/typ/compute/foundations.typ12
2 files changed, 11 insertions, 1 deletions
diff --git a/tests/ref/compute/foundations.png b/tests/ref/compute/foundations.png
new file mode 100644
index 00000000..5d6ba744
--- /dev/null
+++ b/tests/ref/compute/foundations.png
Binary files differ
diff --git a/tests/typ/compute/foundations.typ b/tests/typ/compute/foundations.typ
index 9c7b13ca..3da2e601 100644
--- a/tests/typ/compute/foundations.typ
+++ b/tests/typ/compute/foundations.typ
@@ -73,7 +73,17 @@
#test(type(10 / 3), "float")
---
-#eval("[_Hello" + " World!_]")
+// Test the eval function.
+#test(eval("1 + 2"), 3)
+#test(eval("1 + x", scope: (x: 3)), 4)
+#test(eval("let x = x + 1; x + 1", scope: (x: 1)), 3)
+
+---
+// Test evaluation in other modes.
+// Ref: true
+#eval("[_Hello" + " World!_]") \
+#eval("_Hello" + " World!_", mode: "markup") \
+#eval("RR_1^NN", mode: "math", scope: (RR: math.NN, NN: math.RR))
---
// Error: 7-12 expected identifier