Skip to content

Commit 69199dd

Browse files
author
devfive
committed
Cover normalize_path_key's leading-dot folding arm
Path::components() normalizes inner '.' away on its own and only yields Component::CurDir for a LEADING '.', so the folding loop's CurDir arm is reachable only while the joined path stays relative. The previous case joined against an absolute cwd and therefore never reached it.
1 parent f75017e commit 69199dd

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎crates/vespera_macro/src/file_utils.rs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,14 @@ mod tests {
490490
absolute.ends_with("/work/project/b.rs"),
491491
"an absolute path must not be re-rooted at cwd: {absolute}"
492492
);
493+
494+
// `Path::components()` normalizes inner `.` away by itself and only ever
495+
// yields `Component::CurDir` for a LEADING `.`, so the folding loop's
496+
// `CurDir` arm is reachable only when the joined path stays relative.
497+
assert_eq!(
498+
normalize_path_key("./routes/./users.rs", Path::new(".")),
499+
"routes/users.rs"
500+
);
493501
}
494502

495503
#[test]

0 commit comments

Comments
 (0)