summaryrefslogtreecommitdiff
path: root/tests/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-24 17:51:07 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-24 17:51:07 +0100
commit96f72eee6c6b595164c7a0576c407d7a590661db (patch)
treed212f57faf3e919937921884a75bf45efb02f4ae /tests/src
parent8d3c68a1deb28dce2b80ed61f85141180ce6a951 (diff)
Separate typesetting and compilation
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/benches.rs12
-rw-r--r--tests/src/tests.rs2
2 files changed, 11 insertions, 3 deletions
diff --git a/tests/src/benches.rs b/tests/src/benches.rs
index 1e5550c5..754f80a9 100644
--- a/tests/src/benches.rs
+++ b/tests/src/benches.rs
@@ -21,6 +21,7 @@ main!(
bench_edit,
bench_eval,
bench_typeset,
+ bench_compile,
bench_highlight,
bench_render,
);
@@ -81,12 +82,19 @@ fn bench_eval(iai: &mut Iai) {
fn bench_typeset(iai: &mut Iai) {
let world = BenchWorld::new();
- iai.run(|| typst::typeset(&world, &world.source));
+ let route = typst::model::Route::default();
+ let module = typst::model::eval(world.track(), route.track(), &world.source).unwrap();
+ iai.run(|| typst::model::typeset(world.track(), &module.content));
+}
+
+fn bench_compile(iai: &mut Iai) {
+ let world = BenchWorld::new();
+ iai.run(|| typst::compile(&world, &world.source));
}
fn bench_render(iai: &mut Iai) {
let world = BenchWorld::new();
- let frames = typst::typeset(&world, &world.source).unwrap();
+ let frames = typst::compile(&world, &world.source).unwrap();
iai.run(|| typst::export::render(&frames[0], 1.0))
}
diff --git a/tests/src/tests.rs b/tests/src/tests.rs
index 2c0a1e71..f96c651b 100644
--- a/tests/src/tests.rs
+++ b/tests/src/tests.rs
@@ -424,7 +424,7 @@ fn test_part(
println!("Model:\n{:#?}\n", module.content);
}
- let (mut frames, errors) = match typst::typeset(world, source) {
+ let (mut frames, errors) = match typst::compile(world, source) {
Ok(frames) => (frames, vec![]),
Err(errors) => (vec![], *errors),
};