diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-01-13 15:44:41 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-01-13 15:44:41 +0100 |
| commit | 1d01b93f679bccf8f228616bcf0f0ebcdee64d98 (patch) | |
| tree | 3fa476cf5f783fcbb22614e0b7b53cb25a398b91 /tests | |
| parent | 60154474ba1cf4a556bbed7f80ee0947c29dbca8 (diff) | |
Move comment tests to integration 🚚
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ref/comments.png | bin | 0 -> 1469 bytes | |||
| -rw-r--r-- | tests/typ/comments.typ | 23 | ||||
| -rw-r--r-- | tests/typeset.rs | 9 |
3 files changed, 31 insertions, 1 deletions
diff --git a/tests/ref/comments.png b/tests/ref/comments.png Binary files differnew file mode 100644 index 00000000..399d25a1 --- /dev/null +++ b/tests/ref/comments.png 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, .. }, |
