summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-07-20 18:35:05 +0200
committerLaurenz <laurmaedje@gmail.com>2021-07-20 18:35:05 +0200
commit8000783f95ee007d9dda6f1dcc1c42c8e607b122 (patch)
tree85f959948efb97bfc36e4f46c817b21c813e9744 /tests
parent5edbd3a5b58c11939ea9823c6a847ba447254cb6 (diff)
FileId instead of Path + FileHash
Diffstat (limited to 'tests')
-rw-r--r--tests/typeset.rs15
1 files changed, 5 insertions, 10 deletions
diff --git a/tests/typeset.rs b/tests/typeset.rs
index 254d1b9e..512e5879 100644
--- a/tests/typeset.rs
+++ b/tests/typeset.rs
@@ -18,7 +18,7 @@ use typst::exec::{exec, State};
use typst::geom::{self, Length, PathElement, Point, Sides, Size};
use typst::image::ImageId;
use typst::layout::{layout, Element, Frame, Geometry, Paint, Text};
-use typst::loading::FsLoader;
+use typst::loading::{FileId, FsLoader};
use typst::parse::{parse, LineMap, Scanner};
use typst::syntax::{Location, Pos};
@@ -136,6 +136,7 @@ fn test(
println!("Testing {}", name.display());
let src = fs::read_to_string(src_path).unwrap();
+ let src_id = loader.resolve_path(src_path).unwrap();
let mut ok = true;
let mut frames = vec![];
@@ -159,7 +160,7 @@ fn test(
}
} else {
let (part_ok, compare_here, part_frames) =
- test_part(loader, cache, src_path, part, i, compare_ref, lines);
+ test_part(loader, cache, src_id, part, i, compare_ref, lines);
ok &= part_ok;
compare_ever |= compare_here;
frames.extend(part_frames);
@@ -200,7 +201,7 @@ fn test(
fn test_part(
loader: &mut FsLoader,
cache: &mut Cache,
- src_path: &Path,
+ src_id: FileId,
src: &str,
i: usize,
compare_ref: bool,
@@ -222,13 +223,7 @@ fn test_part(
state.page.margins = Sides::splat(Some(Length::pt(10.0).into()));
let parsed = parse(src);
- let evaluated = eval(
- loader,
- cache,
- Some(src_path),
- Rc::new(parsed.output),
- &scope,
- );
+ let evaluated = eval(loader, cache, src_id, Rc::new(parsed.output), &scope);
let executed = exec(&evaluated.output.template, state.clone());
let mut layouted = layout(loader, cache, &executed.output);