summaryrefslogtreecommitdiff
path: root/tests/typ/base/eval.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-03 16:50:26 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-03 16:50:26 +0100
commit33928a00dc58250e24da1dae4e5db17e7b598d70 (patch)
tree451083aa64f57b442359875b0415541463cb1a0c /tests/typ/base/eval.typ
parent46921a8c283718402322d4d09c0bd1d9194278b1 (diff)
Tidy up library
Diffstat (limited to 'tests/typ/base/eval.typ')
-rw-r--r--tests/typ/base/eval.typ52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/typ/base/eval.typ b/tests/typ/base/eval.typ
new file mode 100644
index 00000000..86b1f0c4
--- /dev/null
+++ b/tests/typ/base/eval.typ
@@ -0,0 +1,52 @@
+// Test the `eval` function.
+
+---
+#eval("_Hello" + " World!_")
+
+---
+// Error: 7-13 expected identifier
+#eval("#let")
+
+---
+#set raw(around: none)
+#show it: raw as text("IBM Plex Sans", eval(it.text))
+
+Interacting
+```
+#set text(blue)
+Blue #move(dy: -0.15em)[🌊]
+```
+
+---
+// Error: 7-19 cannot continue outside of loop
+#eval("{continue}")
+
+---
+// Error: 7-33 cannot access file system from here
+#eval("#include \"../coma.typ\"")
+
+---
+// Error: 7-35 cannot access file system from here
+#eval("#image(\"/res/tiger.jpg\")")
+
+---
+// Error: 23-30 cannot access file system from here
+#show it: raw as eval(it.text)
+
+```
+#show strong as image("/res/tiger.jpg")
+*No absolute tiger!*
+```
+
+---
+// Error: 23-30 cannot access file system from here
+#show it: raw as eval(it.text)
+
+```
+#show emph as image("../../res/giraffe.jpg")
+_No relative giraffe!_
+```
+
+---
+// Error: 7-16 expected comma
+#eval("{(1 2)}")