mirror of
https://github.com/typst/typst
synced 2025-07-27 14:27:56 +08:00
Update in tests/ too the PathBuf in FileError
This commit is contained in:
parent
f3d5cdc6a5
commit
3b5ee3c488
@ -172,7 +172,9 @@ pub(crate) fn system_path(id: FileId) -> FileResult<PathBuf> {
|
||||
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<Cow<'static, [u8]>> {
|
||||
|
||||
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)
|
||||
}
|
||||
|
@ -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": *
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user