summaryrefslogtreecommitdiff
path: root/tests/src/benches.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-17 16:27:40 +0100
committerLaurenz <laurmaedje@gmail.com>2023-03-17 18:18:47 +0100
commitaf7fe4d76083c597ec2198a73383b9e3899d75ea (patch)
treecb3b9766ee15dbfbecf7f9b9a2257859d7a7b3c7 /tests/src/benches.rs
parent6d64d3e8e9123f3fa8166c8b710e2b2c61ed5898 (diff)
Hover and autocomplete in show rules
Diffstat (limited to 'tests/src/benches.rs')
-rw-r--r--tests/src/benches.rs26
1 files changed, 15 insertions, 11 deletions
diff --git a/tests/src/benches.rs b/tests/src/benches.rs
index 21fdbc7a..b1e77692 100644
--- a/tests/src/benches.rs
+++ b/tests/src/benches.rs
@@ -80,17 +80,17 @@ fn bench_typeset(iai: &mut Iai) {
)
.unwrap();
let content = module.content();
- iai.run(|| typst::model::typeset(world.track(), &content));
+ iai.run(|| typst::model::typeset(world.track(), tracer.track_mut(), &content));
}
fn bench_compile(iai: &mut Iai) {
let world = BenchWorld::new();
- iai.run(|| typst::compile(&world, &world.source));
+ iai.run(|| typst::compile(&world));
}
fn bench_render(iai: &mut Iai) {
let world = BenchWorld::new();
- let document = typst::compile(&world, &world.source).unwrap();
+ let document = typst::compile(&world).unwrap();
iai.run(|| typst::export::render(&document.pages[0], 1.0, Color::WHITE))
}
@@ -124,6 +124,18 @@ impl World for BenchWorld {
&self.library
}
+ fn main(&self) -> &Source {
+ &self.source
+ }
+
+ fn resolve(&self, path: &Path) -> FileResult<SourceId> {
+ Err(FileError::NotFound(path.into()))
+ }
+
+ fn source(&self, _: SourceId) -> &Source {
+ &self.source
+ }
+
fn book(&self) -> &Prehashed<FontBook> {
&self.book
}
@@ -135,12 +147,4 @@ impl World for BenchWorld {
fn file(&self, path: &Path) -> FileResult<Buffer> {
Err(FileError::NotFound(path.into()))
}
-
- fn resolve(&self, path: &Path) -> FileResult<SourceId> {
- Err(FileError::NotFound(path.into()))
- }
-
- fn source(&self, _: SourceId) -> &Source {
- unimplemented!()
- }
}