summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/typeset.rs13
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);