summaryrefslogtreecommitdiff
path: root/tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/benches.rs14
-rw-r--r--tests/src/tests.rs6
2 files changed, 8 insertions, 12 deletions
diff --git a/tests/src/benches.rs b/tests/src/benches.rs
index 5c9b5433..29117a90 100644
--- a/tests/src/benches.rs
+++ b/tests/src/benches.rs
@@ -74,21 +74,18 @@ fn bench_highlight(iai: &mut Iai) {
fn bench_eval(iai: &mut Iai) {
let world = BenchWorld::new();
- let id = world.source.id();
let route = typst::model::Route::default();
- iai.run(|| typst::model::eval(world.track(), route.track(), id).unwrap());
+ iai.run(|| typst::model::eval(world.track(), route.track(), &world.source).unwrap());
}
fn bench_typeset(iai: &mut Iai) {
let world = BenchWorld::new();
- let id = world.source.id();
- iai.run(|| typst::typeset(&world, id));
+ iai.run(|| typst::typeset(&world, &world.source));
}
fn bench_render(iai: &mut Iai) {
let world = BenchWorld::new();
- let id = world.source.id();
- let frames = typst::typeset(&world, id).unwrap();
+ let frames = typst::typeset(&world, &world.source).unwrap();
iai.run(|| typst::export::render(&frames[0], 1.0))
}
@@ -110,8 +107,7 @@ impl BenchWorld {
let font = Font::new(FONT.into(), 0).unwrap();
let book = FontBook::from_fonts([&font]);
- let id = SourceId::from_u16(0);
- let source = Source::new(id, Path::new("bench.typ"), TEXT.into());
+ let source = Source::detached(TEXT);
Self {
config: Prehashed::new(config),
@@ -148,6 +144,6 @@ impl World for BenchWorld {
}
fn source(&self, _: SourceId) -> &Source {
- &self.source
+ unimplemented!()
}
}
diff --git a/tests/src/tests.rs b/tests/src/tests.rs
index 52cc54db..89c83857 100644
--- a/tests/src/tests.rs
+++ b/tests/src/tests.rs
@@ -418,13 +418,13 @@ fn test_part(
ok &= test_reparse(world.source(id).text(), i, rng);
if world.print.model {
- let tracked = (world as &dyn World).track();
+ let world = (world as &dyn World).track();
let route = typst::model::Route::default();
- let module = typst::model::eval(tracked, route.track(), id).unwrap();
+ let module = typst::model::eval(world, route.track(), source).unwrap();
println!("Model:\n{:#?}\n", module.content);
}
- let (mut frames, errors) = match typst::typeset(world, id) {
+ let (mut frames, errors) = match typst::typeset(world, source) {
Ok(frames) => (frames, vec![]),
Err(errors) => (vec![], *errors),
};