test(dir): compare planned paths via rel_str so Windows backslash display cannot leak into assertions

This commit is contained in:
loki5512344 2026-09-15 18:33:24 +02:00
parent 6f7a2190e6
commit 4e78a1c2b8
Signed by: boba
GPG key ID: 253067914055423B

View file

@ -183,10 +183,16 @@ mod tests {
let index = Index::build(dir.path())?; let index = Index::build(dir.path())?;
let plan = plan_move(&index, Path::new("lib"), Path::new("core/lib"))?; let plan = plan_move(&index, Path::new("lib"), Path::new("core/lib"))?;
assert_eq!(plan.prune_dirs, [PathBuf::from("lib")]); assert_eq!(plan.prune_dirs, [PathBuf::from("lib")]);
let moves: Vec<(&str, &str)> = plan // rel_str: canonical '/' display, stable across platforms.
let moves: Vec<(String, String)> = plan
.moves .moves
.iter() .iter()
.map(|m| (m.source.to_str().unwrap(), m.target.to_str().unwrap())) .map(|m| {
(
crate::core::rel_str(&m.source),
crate::core::rel_str(&m.target),
)
})
.collect(); .collect();
assert_eq!( assert_eq!(
moves, moves,