From ddaec8aa85c2b75599ab3067f0cd8b010435ded8 Mon Sep 17 00:00:00 2001 From: Neven Villani Date: Thu, 12 Jun 2025 15:53:36 +0200 Subject: [PATCH] Update in tests/ too the PathBuf in FileError --- tests/src/world.rs | 6 ++++-- tests/suite/scripting/import.typ | 16 ++-------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/tests/src/world.rs b/tests/src/world.rs index 6fa1cf60f..03bbb20b1 100644 --- a/tests/src/world.rs +++ b/tests/src/world.rs @@ -172,7 +172,9 @@ pub(crate) fn system_path(id: FileId) -> FileResult { None => PathBuf::new(), }; - id.vpath().resolve(&root).ok_or(FileError::AccessDenied) + id.vpath() + .resolve(&root) + .ok_or_else(|| FileError::AccessDenied(id.vpath().as_rootless_path().into())) } /// Read a file. @@ -186,7 +188,7 @@ pub(crate) fn read(path: &Path) -> FileResult> { let f = |e| FileError::from_io(e, path); if fs::metadata(path).map_err(f)?.is_dir() { - Err(FileError::IsDirectory) + Err(FileError::IsDirectory(path.into())) } else { fs::read(path).map(Cow::Owned).map_err(f) } diff --git a/tests/suite/scripting/import.typ b/tests/suite/scripting/import.typ index 9fbd889fa..f094042bc 100644 --- a/tests/suite/scripting/import.typ +++ b/tests/suite/scripting/import.typ @@ -302,11 +302,11 @@ #import 5 as x --- import-from-string-invalid --- -// Error: 9-11 failed to load file (is a directory) +// Error: 9-11 failed to load file tests/suite/scripting (is a directory) #import "": name --- import-from-string-renamed-invalid --- -// Error: 9-11 failed to load file (is a directory) +// Error: 9-11 failed to load file tests/suite/scripting (is a directory) #import "" as x --- import-file-not-found-invalid --- @@ -484,15 +484,3 @@ This is never reached. // Error: 9-28 file not found (searched at tests/suite/scripting/#test/mypkg:1.0.0) #import "#test/mypkg:1.0.0": * ---- import-from-package-namespace-not-found --- -// Error: 9-33 package not found -#import "@missingdir/test:0.0.0": * - ---- import-from-package-not-found --- -// Error: 9-33 package not found -#import "@test/missingpkg:0.0.0": * - ---- import-from-package-version-not-found --- -// Error: 9-28 package not found -#import "@test/mypkg:5.0.0": * -