fix(test): #101 nested-path test uses file_name() for Windows portability
Windows preserves the user-typed `/` when Path::join() ingests a multi- component string with forward slashes, producing a mixed-separator path in the rendered <file> block (e.g. `C:\...\.tmpKxj0Pk\nested/deep/file.md`). The test compared full paths via display(), which mismatched. Switch to a basename comparison per CLAUDE.md's portability rule. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -588,9 +588,16 @@ mod tests {
|
||||
|
||||
assert!(content.contains("# nested deep"), "got: {content}");
|
||||
assert!(!content.contains("<missing-file"), "got: {content}");
|
||||
// Path-separator-portable check: the resolved path's filename is the
|
||||
// most reliable cross-platform anchor (Windows mixes `/` and `\` when
|
||||
// join() preserves user-typed separators).
|
||||
let basename = file_md
|
||||
.file_name()
|
||||
.and_then(|n| n.to_str())
|
||||
.expect("file_name utf-8");
|
||||
assert!(
|
||||
content.contains(&file_md.display().to_string()),
|
||||
"got: {content}",
|
||||
content.contains(basename),
|
||||
"basename {basename} not in path; got: {content}",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user