Merge PR #2547: Tests: discovery tests use the platform's path separator (Windows)

This commit is contained in:
aiongg
2026-10-31 02:06:38 +00:00
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -39,7 +39,9 @@ fn recursive_discovery_includes_sony_sr2_and_srf_case_insensitively() {
let src = temp_dir("sony-discovery");
std::fs::create_dir_all(src.join("trip/day2")).unwrap();
let names = ["r1.SR2", "f828.srf", "trip/r1.sr2", "trip/f828.SRF", "trip/day2/r1.Sr2", "trip/day2/f828.SrF", "control.JPG"];
let mut expected: Vec<String> = names.iter().map(|name| src.join(name).to_string_lossy().into_owned()).collect();
// one component at a time: `join("trip/r1.sr2")` keeps the `/`, discovery yields the platform's separator
let mut expected: Vec<String> =
names.iter().map(|name| name.split('/').fold(src.clone(), |p, c| p.join(c)).to_string_lossy().into_owned()).collect();
for path in &expected {
std::fs::write(path, b"discovery only, not a decoded photo").unwrap();
}
+1 -1
View File
@@ -207,7 +207,7 @@ mod tests {
fn folder_discovery_matches_engine_extensions() {
let dir = std::env::temp_dir().join(format!("lc-mcp-discovery-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
let nested = dir.join("trip/day2");
let nested = dir.join("trip").join("day2"); // not "trip/day2": discovery yields the platform's separator
std::fs::create_dir_all(&nested).unwrap();
let mut expected = Vec::new();
for ext in lightcraft_engine::import::EXTENSIONS {