diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-03-01 16:30:58 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-03-01 16:33:28 +0100 |
| commit | 6ab7760822ccd24b4ef126d4737d41f1be15fe19 (patch) | |
| tree | 49905f91d292ceefe4f9878ead43f117c4b1fec0 /tests/src | |
| parent | ab841188e3d2687ee8f436336e6fde337985a83e (diff) | |
Split up `model` module
Diffstat (limited to 'tests/src')
| -rw-r--r-- | tests/src/benches.rs | 21 | ||||
| -rw-r--r-- | tests/src/tests.rs | 12 |
2 files changed, 14 insertions, 19 deletions
diff --git a/tests/src/benches.rs b/tests/src/benches.rs index 1628f32d..ea53f602 100644 --- a/tests/src/benches.rs +++ b/tests/src/benches.rs @@ -3,8 +3,8 @@ use std::path::Path; use comemo::{Prehashed, Track, Tracked}; use iai::{black_box, main, Iai}; use typst::diag::{FileError, FileResult}; +use typst::eval::Library; use typst::font::{Font, FontBook}; -use typst::model::Library; use typst::syntax::{Source, SourceId}; use typst::util::Buffer; use typst::World; @@ -59,24 +59,19 @@ fn bench_edit(iai: &mut Iai) { fn bench_eval(iai: &mut Iai) { let world = BenchWorld::new(); - let route = typst::model::Route::default(); - let mut tracer = typst::model::Tracer::default(); + let route = typst::eval::Route::default(); + let mut tracer = typst::eval::Tracer::default(); iai.run(|| { - typst::model::eval( - world.track(), - route.track(), - tracer.track_mut(), - &world.source, - ) - .unwrap() + typst::eval::eval(world.track(), route.track(), tracer.track_mut(), &world.source) + .unwrap() }); } fn bench_typeset(iai: &mut Iai) { let world = BenchWorld::new(); - let route = typst::model::Route::default(); - let mut tracer = typst::model::Tracer::default(); - let module = typst::model::eval( + let route = typst::eval::Route::default(); + let mut tracer = typst::eval::Tracer::default(); + let module = typst::eval::eval( world.track(), route.track(), tracer.track_mut(), diff --git a/tests/src/tests.rs b/tests/src/tests.rs index 62e6f3f5..0c2b0490 100644 --- a/tests/src/tests.rs +++ b/tests/src/tests.rs @@ -13,9 +13,9 @@ use once_cell::unsync::OnceCell; use tiny_skia as sk; use typst::diag::{bail, FileError, FileResult, SourceResult}; use typst::doc::{Document, Element, Frame, Meta}; +use typst::eval::{func, Library, Value}; use typst::font::{Font, FontBook}; use typst::geom::{Abs, RgbaColor, Sides, Smart}; -use typst::model::{func, Library, Value}; use typst::syntax::{Source, SourceId, Span, SyntaxNode}; use typst::util::{Buffer, PathExt}; use typst::World; @@ -150,7 +150,7 @@ fn library() -> Library { /// ## Category /// test #[func] - fn test(args: &mut typst::model::Args) -> SourceResult<Value> { + fn test(args: &mut typst::eval::Args) -> SourceResult<Value> { let lhs = args.expect::<Value>("left-hand side")?; let rhs = args.expect::<Value>("right-hand side")?; if lhs != rhs { @@ -163,7 +163,7 @@ fn library() -> Library { /// ## Category /// test #[func] - fn print(args: &mut typst::model::Args) -> SourceResult<Value> { + fn print(args: &mut typst::eval::Args) -> SourceResult<Value> { print!("> "); for (i, value) in args.all::<Value>()?.into_iter().enumerate() { if i > 0 { @@ -441,10 +441,10 @@ fn test_part( if world.print.model { let world = (world as &dyn World).track(); - let route = typst::model::Route::default(); - let mut tracer = typst::model::Tracer::default(); + let route = typst::eval::Route::default(); + let mut tracer = typst::eval::Tracer::default(); let module = - typst::model::eval(world, route.track(), tracer.track_mut(), source).unwrap(); + typst::eval::eval(world, route.track(), tracer.track_mut(), source).unwrap(); println!("Model:\n{:#?}\n", module.content()); } |
