From 05a65916ae3df9be7b3c95e0291e2eadac2a68ee Mon Sep 17 00:00:00 2001 From: A Farzat Date: Sat, 6 Jun 2026 14:29:16 +0300 Subject: Ensure lexically duplicate paths are detected --- src/main.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 7455e23..dbd1a60 100644 --- a/src/main.rs +++ b/src/main.rs @@ -291,6 +291,25 @@ mod tests { assert!(a_pos < b_pos); } + #[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(); -- cgit v1.3.1