From ca7683e47fae9ca3355948ac2a3f507254c21195 Mon Sep 17 00:00:00 2001 From: OneSlips Date: Thu, 22 Oct 2026 20:28:24 +1000 Subject: [PATCH] Tests: discovery tests build their expected paths with the platform's separator `recursive_discovery_includes_sony_sr2_and_srf_case_insensitively` (engine) and `folder_discovery_matches_engine_extensions` (mcp) joined "trip/day2/..." as one string, so on Windows the expected paths kept `/` while discovery returns `\`, and both failed. They now join one component at a time. Test-only change. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/tests_import.rs | 4 +++- crates/mcp/src/headless.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/tests_import.rs b/crates/engine/src/tests_import.rs index 191595ebe..b8a66161a 100644 --- a/crates/engine/src/tests_import.rs +++ b/crates/engine/src/tests_import.rs @@ -35,7 +35,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 = 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 = + 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(); } diff --git a/crates/mcp/src/headless.rs b/crates/mcp/src/headless.rs index d62a9a707..e281437c5 100644 --- a/crates/mcp/src/headless.rs +++ b/crates/mcp/src/headless.rs @@ -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 {