summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2026-06-06 14:29:16 +0300
committerA Farzat <a@farzat.xyz>2026-06-06 15:05:28 +0300
commit05a65916ae3df9be7b3c95e0291e2eadac2a68ee (patch)
tree42a5238600916e3150d73c067dcca314504e3422 /src/main.rs
parentf7fa7f10fae59f7128317c0406b961f113c60dd3 (diff)
downloadrepo2markdown-05a65916ae3df9be7b3c95e0291e2eadac2a68ee.tar.gz
repo2markdown-05a65916ae3df9be7b3c95e0291e2eadac2a68ee.zip
Ensure lexically duplicate paths are detected
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 7455e23..dbd1a60 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -292,6 +292,25 @@ mod tests {
}
#[test]
+ fn lexically_equivalent_paths_are_detected_as_duplicates() {
+ let temp_dir = tempdir().unwrap();
+ let origin = temp_dir.path();
+ let root = temp_dir.path();
+
+ fs::create_dir_all(origin.join("bla")).unwrap();
+ fs::write(origin.join("a.rs"), "A").unwrap();
+ fs::write(origin.join("b.rs"), "B").unwrap();
+
+ let input = Cursor::new(b"a.rs\0b.rs\0bla/../a.rs\0");
+ let mut output = Vec::new();
+
+ run_with_default_logger(input, &mut output, root, origin, None).unwrap();
+
+ let output = String::from_utf8(output).unwrap();
+ assert_eq!(output.matches("## File: a.rs").count(), 1);
+ }
+
+ #[test]
fn project_name_is_derived_from_root_by_default_even_if_directory_does_not_exist() {
let temp_dir = tempdir().unwrap();
let origin_base = temp_dir.path();