summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMyriad-Dreamin <35292584+Myriad-Dreamin@users.noreply.github.com>2024-07-14 21:14:21 +0800
committerGitHub <noreply@github.com>2024-07-14 13:14:21 +0000
commita3f3a1a83330e3fe9a686fbe4c0eda9f1e9e99b2 (patch)
tree0c6b10649101d75573e453498901907bdec5a8b3 /tests
parent4d8976b619fbb2ab19c1e46fccbca4294c0c2d0b (diff)
Change the signature of `World::main` (#4531)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/fuzz/src/compile.rs16
-rw-r--r--tests/src/world.rs4
2 files changed, 12 insertions, 8 deletions
diff --git a/tests/fuzz/src/compile.rs b/tests/fuzz/src/compile.rs
index 98c300ce..c9536150 100644
--- a/tests/fuzz/src/compile.rs
+++ b/tests/fuzz/src/compile.rs
@@ -39,16 +39,20 @@ impl World for FuzzWorld {
&self.book
}
- fn main(&self) -> Source {
- self.source.clone()
+ fn main(&self) -> FileId {
+ self.source.id()
}
- fn source(&self, src: FileId) -> FileResult<Source> {
- Err(FileError::NotFound(src.vpath().as_rootless_path().into()))
+ fn source(&self, id: FileId) -> FileResult<Source> {
+ if id == self.source.id() {
+ Ok(self.source.clone())
+ } else {
+ Err(FileError::NotFound(id.vpath().as_rootless_path().into()))
+ }
}
- fn file(&self, src: FileId) -> FileResult<Bytes> {
- Err(FileError::NotFound(src.vpath().as_rootless_path().into()))
+ fn file(&self, id: FileId) -> FileResult<Bytes> {
+ Err(FileError::NotFound(id.vpath().as_rootless_path().into()))
}
fn font(&self, _: usize) -> Option<Font> {
diff --git a/tests/src/world.rs b/tests/src/world.rs
index ad925a53..47b77d7e 100644
--- a/tests/src/world.rs
+++ b/tests/src/world.rs
@@ -43,8 +43,8 @@ impl World for TestWorld {
&self.base.book
}
- fn main(&self) -> Source {
- self.main.clone()
+ fn main(&self) -> FileId {
+ self.main.id()
}
fn source(&self, id: FileId) -> FileResult<Source> {