From 7de8663522f5c41f79e6025f5db86058619a208a Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 12 Aug 2026 15:33:12 +0200 Subject: [PATCH] add test for unreachable gitignore whitelists --- crates/oxide/tests/scanner.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/crates/oxide/tests/scanner.rs b/crates/oxide/tests/scanner.rs index b1bf7f857..3653d6473 100644 --- a/crates/oxide/tests/scanner.rs +++ b/crates/oxide/tests/scanner.rs @@ -4334,6 +4334,27 @@ mod scanner { assert_eq!(files, vec![".env"]); } + #[test] + fn unreachable_whitelists_do_not_reinclude_explicit_source_directories() { + let ScanResult { + candidates, files, .. + } = scan_with_globs( + &[ + (".gitignore", "parent/"), + ("parent/.gitignore", "!child/"), + ("parent/child/.gitignore", "index.html"), + ( + "parent/child/index.html", + "content-['parent/child/index.html']", + ), + ], + vec!["@source './parent/child'"], + ); + + assert_eq!(candidates, vec!["content-['parent/child/index.html']"]); + assert_eq!(files, vec!["parent/child/index.html"]); + } + #[test] fn test_extract_used_css_variables_from_css() { let dir = tempdir().unwrap().into_path();