Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Tests: discovery tests build their expected paths with the platform's separator

OneSlipsca7683e47fae
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<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();
}
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 {