diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-16 19:13:39 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-16 20:22:48 +0200 |
| commit | 242b01549a472d4eeca1404b8f63427e23224253 (patch) | |
| tree | 7d44ef801ce857469912a75233a1e7a1603e405e /tests | |
| parent | a741bd6b83d1e374c8218b5439e26522499cc4ae (diff) | |
Safe `eval` function
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ref/utility/eval.png | bin | 0 -> 5429 bytes | |||
| -rw-r--r-- | tests/typ/utility/eval.typ | 52 |
2 files changed, 52 insertions, 0 deletions
diff --git a/tests/ref/utility/eval.png b/tests/ref/utility/eval.png Binary files differnew file mode 100644 index 00000000..38c1d64e --- /dev/null +++ b/tests/ref/utility/eval.png diff --git a/tests/typ/utility/eval.typ b/tests/typ/utility/eval.typ new file mode 100644 index 00000000..86b1f0c4 --- /dev/null +++ b/tests/typ/utility/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)}") |
