craft-xtask: compare canonical paths in the working-directory test

On macOS the temp directory is under /var, a link to /private/var, so current_dir() reads back the /private/var path and the assert failed on main's macOS gate.
This commit is contained in:
bflatastic committed 2026-11-28 18:55:41 +07:00
1 parent f83e228e81
commit 6b41fb6814
1 file changed
+3 -1
+3 -1
View File
@@ -2857,7 +2857,9 @@ fn seven() { let _ = "seven"; }
let policy = Policy { skip: change_directory, ..POLICY };
let found = scan(Path::new("."), &[Input::rust(Path::new("src"))], &policy).unwrap();
assert_eq!(hits(&found), [("src/a.rs".to_owned(), 1, "AzureKit")]);
assert_eq!(std::env::current_dir().unwrap(), PathBuf::from(root).join("switched"));
// Canonical on both sides: macOS temp paths run through the /var -> /private/var link.
let canonical = |p: PathBuf| p.canonicalize().unwrap();
assert_eq!(canonical(std::env::current_dir().unwrap()), canonical(PathBuf::from(root).join("switched")));
return;
}
let dir = tempfile::tempdir().unwrap();