diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-05-27 14:19:58 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-05-27 14:19:58 +0200 |
| commit | ae68a15a46c3a9fce4db7bfbf129ee103dd4c30d (patch) | |
| tree | 6d038e364422946f3a076a9ff3f68ca877c441c1 /tests | |
| parent | 9950a69d23a6415cdbea08bc770f4019344318a0 (diff) | |
Print function for debugging
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/typeset.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/typeset.rs b/tests/typeset.rs index 72bdb431..0d603125 100644 --- a/tests/typeset.rs +++ b/tests/typeset.rs @@ -70,7 +70,7 @@ fn main() { ); styles.set(TextNode::SIZE, TextSize(Length::pt(10.0).into())); - // Hook up two more colors and an assert function into the global scope. + // Hook up helpers into the global scope. let mut std = typst::library::new(); std.define("conifer", RgbaColor::new(0x9f, 0xEB, 0x52, 0xFF)); std.define("forest", RgbaColor::new(0x43, 0xA1, 0x27, 0xFF)); @@ -82,6 +82,17 @@ fn main() { } Ok(Value::None) }); + std.def_fn("print", move |_, args| { + print!("> "); + for (i, value) in args.all::<Value>()?.into_iter().enumerate() { + if i > 0 { + print!(", ") + } + print!("{value:?}"); + } + println!(); + Ok(Value::None) + }); // Create loader and context. let loader = FsLoader::new().with_path(FONT_DIR); |
