summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-05-13 19:54:34 +0200
committerGitHub <noreply@github.com>2024-05-13 17:54:34 +0000
commit2d32ac73b63c81ea2754916feb7758c042f4ed3d (patch)
treec9770897cbb1134187132d6835702a1869a74a0a /tests
parent95cd6adf24cb14ede8896fbb0c610432960f4f3a (diff)
Replace all `Prehashed` with `LazyHash` (#4127)
Diffstat (limited to 'tests')
-rw-r--r--tests/fuzz/src/compile.rs14
-rw-r--r--tests/src/world.rs14
2 files changed, 14 insertions, 14 deletions
diff --git a/tests/fuzz/src/compile.rs b/tests/fuzz/src/compile.rs
index 2d445bf5..4dbea410 100644
--- a/tests/fuzz/src/compile.rs
+++ b/tests/fuzz/src/compile.rs
@@ -1,18 +1,18 @@
#![no_main]
-use comemo::Prehashed;
use libfuzzer_sys::fuzz_target;
use typst::diag::{FileError, FileResult};
use typst::eval::Tracer;
use typst::foundations::{Bytes, Datetime};
use typst::syntax::{FileId, Source};
use typst::text::{Font, FontBook};
+use typst::utils::LazyHash;
use typst::visualize::Color;
use typst::{Library, World};
struct FuzzWorld {
- library: Prehashed<Library>,
- book: Prehashed<FontBook>,
+ library: LazyHash<Library>,
+ book: LazyHash<FontBook>,
font: Font,
source: Source,
}
@@ -23,8 +23,8 @@ impl FuzzWorld {
let font = Font::new(Bytes::from_static(data), 0).unwrap();
let book = FontBook::from_fonts([&font]);
Self {
- library: Prehashed::new(Library::default()),
- book: Prehashed::new(book),
+ library: LazyHash::new(Library::default()),
+ book: LazyHash::new(book),
font,
source: Source::detached(text),
}
@@ -32,11 +32,11 @@ impl FuzzWorld {
}
impl World for FuzzWorld {
- fn library(&self) -> &Prehashed<Library> {
+ fn library(&self) -> &LazyHash<Library> {
&self.library
}
- fn book(&self) -> &Prehashed<FontBook> {
+ fn book(&self) -> &LazyHash<FontBook> {
&self.book
}
diff --git a/tests/src/world.rs b/tests/src/world.rs
index 86ee8da6..ad925a53 100644
--- a/tests/src/world.rs
+++ b/tests/src/world.rs
@@ -5,7 +5,6 @@ use std::io::Write;
use std::path::{Path, PathBuf};
use std::sync::OnceLock;
-use comemo::Prehashed;
use once_cell::sync::Lazy;
use parking_lot::Mutex;
use typst::diag::{bail, FileError, FileResult, StrResult};
@@ -13,6 +12,7 @@ use typst::foundations::{func, Bytes, Datetime, NoneValue, Repr, Smart, Value};
use typst::layout::{Abs, Margin, PageElem};
use typst::syntax::{FileId, Source};
use typst::text::{Font, FontBook, TextElem, TextSize};
+use typst::utils::LazyHash;
use typst::visualize::Color;
use typst::{Library, World};
@@ -35,11 +35,11 @@ impl TestWorld {
}
impl World for TestWorld {
- fn library(&self) -> &Prehashed<Library> {
+ fn library(&self) -> &LazyHash<Library> {
&self.base.library
}
- fn book(&self) -> &Prehashed<FontBook> {
+ fn book(&self) -> &LazyHash<FontBook> {
&self.base.book
}
@@ -81,8 +81,8 @@ impl TestWorld {
/// Shared foundation of all test worlds.
struct TestBase {
- library: Prehashed<Library>,
- book: Prehashed<FontBook>,
+ library: LazyHash<Library>,
+ book: LazyHash<FontBook>,
fonts: Vec<Font>,
slots: Mutex<HashMap<FileId, FileSlot>>,
}
@@ -95,8 +95,8 @@ impl Default for TestBase {
.collect();
Self {
- library: Prehashed::new(library()),
- book: Prehashed::new(FontBook::from_fonts(&fonts)),
+ library: LazyHash::new(library()),
+ book: LazyHash::new(FontBook::from_fonts(&fonts)),
fonts,
slots: Mutex::new(HashMap::new()),
}