summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/comments.pngbin0 -> 1469 bytes
-rw-r--r--tests/typ/comments.typ23
-rw-r--r--tests/typeset.rs9
3 files changed, 31 insertions, 1 deletions
diff --git a/tests/ref/comments.png b/tests/ref/comments.png
new file mode 100644
index 00000000..399d25a1
--- /dev/null
+++ b/tests/ref/comments.png
Binary files differ
diff --git a/tests/typ/comments.typ b/tests/typ/comments.typ
new file mode 100644
index 00000000..0dfb4b8e
--- /dev/null
+++ b/tests/typ/comments.typ
@@ -0,0 +1,23 @@
+// Test interaction with words, spacing and expressions.
+
+A// you
+B
+
+C/*
+ /* */
+*/D
+
+[dump /*1*/ a: "b" //
+, 1]
+
+---
+// Test error.
+//
+// ref: false
+// error: 3:7-3:9 unexpected end of block comment
+
+// No start of block comment.
+/* */ */
+
+// Unterminated block comment is okay.
+/*
diff --git a/tests/typeset.rs b/tests/typeset.rs
index 554c9149..f3c41151 100644
--- a/tests/typeset.rs
+++ b/tests/typeset.rs
@@ -15,7 +15,7 @@ use ttf_parser::OutlineBuilder;
use typst::diag::{Diag, Feedback, Level, Pass};
use typst::env::{Env, ImageResource, ResourceLoader, SharedEnv};
-use typst::eval::State;
+use typst::eval::{Args, EvalContext, State, Value, ValueFunc};
use typst::export::pdf;
use typst::font::FontLoader;
use typst::geom::{Length, Point, Sides, Size};
@@ -189,6 +189,13 @@ fn test_part(i: usize, src: &str, env: &SharedEnv) -> (bool, Vec<Frame>) {
state.page.size = Size::uniform(Length::pt(120.0));
state.page.margins = Sides::uniform(Some(Length::pt(10.0).into()));
+ pub fn dump(_: &mut EvalContext, args: &mut Args) -> Value {
+ let (array, dict) = args.drain();
+ Value::Array(vec![Value::Array(array), Value::Dict(dict)])
+ }
+
+ Rc::make_mut(&mut state.scope).set("dump", ValueFunc::new("dump", dump));
+
let Pass {
output: mut frames,
feedback: Feedback { mut diags, .. },