Skip to content

Commit ff73820

Browse files
romtsnclaude
andcommitted
fix(bundle-jvm): Make collision warning test Windows-safe
On Windows, `PathBuf::from("/app").join("src/...")` yields `/app\\src/...` (mixed separators), so asserting on forward-slash paths in the warn! output failed. Derive the expected strings from the same path construction the production code walks, then compare via Display. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 246eb5f commit ff73820

1 file changed

Lines changed: 11 additions & 13 deletions

File tree

src/commands/debug_files/bundle_jvm.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -492,18 +492,16 @@ mod tests {
492492
// `WalkBuilder::sort_by_file_name`); the first-seen wins in the dedup.
493493
log_capture::setup();
494494

495-
let sources = vec![
496-
fake_source("/app", "src/debug/java/com/example/Config.java"),
497-
fake_source("/app", "src/main/java/com/example/Config.java"),
498-
];
499-
let files = build_source_files(sources);
495+
let debug_src = fake_source("/app", "src/debug/java/com/example/Config.java");
496+
let main_src = fake_source("/app", "src/main/java/com/example/Config.java");
497+
let kept_display = debug_src.path.display().to_string();
498+
let skipped_display = main_src.path.display().to_string();
499+
500+
let files = build_source_files(vec![debug_src, main_src]);
500501

501502
assert_eq!(files.len(), 1);
502503
assert_eq!(files[0].url, "~/com/example/Config.jvm");
503-
assert_eq!(
504-
files[0].path,
505-
Path::new("/app/src/debug/java/com/example/Config.java")
506-
);
504+
assert_eq!(files[0].path.display().to_string(), kept_display);
507505

508506
let warnings = log_capture::warnings();
509507
assert_eq!(warnings.len(), 1);
@@ -513,12 +511,12 @@ mod tests {
513511
"{msg}"
514512
);
515513
assert!(
516-
msg.contains("/app/src/main/java/com/example/Config.java"),
517-
"missing skipped path in: {msg}"
514+
msg.contains(&skipped_display),
515+
"missing skipped path '{skipped_display}' in: {msg}"
518516
);
519517
assert!(
520-
msg.contains("/app/src/debug/java/com/example/Config.java"),
521-
"missing kept path in: {msg}"
518+
msg.contains(&kept_display),
519+
"missing kept path '{kept_display}' in: {msg}"
522520
);
523521
}
524522

0 commit comments

Comments
 (0)