Merge pull request #1778 from dotCooCoo/fix/link-tests-on-windows

Links: the folder relink and IDML link tests expect Windows paths on Windows
This commit is contained in:
Brandon Thomas
2026-10-25 12:25:54 -04:00
committed by GitHub
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -605,8 +605,10 @@ mod tests {
for link in links {
let (idml, _) = linked_idml(link, false).unwrap();
let (doc, seen) = crate::io::touched(|| import(&idml, Some(&package)).unwrap());
// Beside the package, and the link itself where it is on this computer.
assert!(seen.iter().all(|p| p.starts_with(&dir) || p == std::path::Path::new(link)), "{link}: {seen:?}");
// Beside the package, and the link itself where it is on this computer (on Windows,
// `/dev/zero` is `\dev\zero` on the package's drive).
let itself = crate::io::document_path(link, Some(&package)).ok();
assert!(seen.iter().all(|p| p.starts_with(&dir) || itself.as_ref() == Some(p)), "{link}: {seen:?}");
let asset = doc.assets.values().next().unwrap();
assert!(asset.data.is_empty(), "{link}");
assert_eq!(super::super::links::status(asset, None), "missing", "{link}");
+1 -1
View File
@@ -858,7 +858,7 @@ mod tests {
assert_eq!(a.pixels, Some((60, 20)));
assert_eq!(a.mime, "application/postscript");
assert_eq!(a.data.as_slice(), eps(30).as_bytes());
let moved = dir.join("new/replacement.eps");
let moved = dir.join("new").join("replacement.eps");
std::fs::rename(&replacement, &moved).unwrap();
assert_eq!(s.execute("links.relinkFolder", &json!({"dir": dir.join("new").to_string_lossy()})).unwrap()["relinked"], 1);
assert_eq!(s.doc().unwrap().doc.assets[&aid].link.as_deref(), moved.to_str());