diff --git a/crates/socket-patch-cli/src/commands/gem_refresh.rs b/crates/socket-patch-cli/src/commands/gem_refresh.rs index 09e59f8ee..35c3df66c 100644 --- a/crates/socket-patch-cli/src/commands/gem_refresh.rs +++ b/crates/socket-patch-cli/src/commands/gem_refresh.rs @@ -1665,10 +1665,10 @@ mod tests { `rm -f {} {} {} {} && bundle install`; another project that still pins \ the hosted patch of them then loads the upstream code, which \ `socket-patch scan` reports there.", - shell_word(&home.join("specifications/rack-1.0.0.gemspec")), - shell_word(&home.join("cache/rack-1.0.0.gem")), - shell_word(&home.join("specifications/rexml-1.0.0.gemspec")), - shell_word(&home.join("cache/rexml-1.0.0.gem")), + shell_word(&home.join("specifications").join("rack-1.0.0.gemspec")), + shell_word(&home.join("cache").join("rack-1.0.0.gem")), + shell_word(&home.join("specifications").join("rexml-1.0.0.gemspec")), + shell_word(&home.join("cache").join("rexml-1.0.0.gem")), ), ] ); diff --git a/crates/socket-patch-cli/tests/e2e_gem_native_ext_build.rs b/crates/socket-patch-cli/tests/e2e_gem_native_ext_build.rs index bcf025be1..a19239eb0 100644 --- a/crates/socket-patch-cli/tests/e2e_gem_native_ext_build.rs +++ b/crates/socket-patch-cli/tests/e2e_gem_native_ext_build.rs @@ -3183,11 +3183,10 @@ impl JavaGem { /// The gem file `file` as [`walk_files`] of `vendor/` names it. fn vendor_rel(&self, file: &str) -> String { - let mut path = self - .gem_dir - .strip_prefix(self.proj.join("vendor")) - .unwrap() - .to_path_buf(); + // Component by component: `gem_dir` was joined from `/` strings, + // and Windows would keep those separators where the walk has `\`. + let rel = self.gem_dir.strip_prefix(self.proj.join("vendor")).unwrap(); + let mut path: PathBuf = rel.components().collect(); path.extend(file.split('/')); path.display().to_string() } diff --git a/crates/socket-patch-cli/tests/get/get_update_summary_e2e.rs b/crates/socket-patch-cli/tests/get/get_update_summary_e2e.rs index b7f742870..60bb9bce2 100644 --- a/crates/socket-patch-cli/tests/get/get_update_summary_e2e.rs +++ b/crates/socket-patch-cli/tests/get/get_update_summary_e2e.rs @@ -88,6 +88,16 @@ async fn mount_mocks(mock: &MockServer) { .await; } +/// The manifest as the save line names it: the default `--cwd` (`.`) joined +/// with the default manifest path, so `./.socket/manifest.json` on Unix and +/// `.\.socket/manifest.json` on Windows. +fn manifest_label() -> String { + std::path::Path::new(".") + .join(".socket/manifest.json") + .display() + .to_string() +} + /// Run `get --save-only` against `mock`, returning `(code, stdout, stderr)`. fn run_get(cwd: &std::path::Path, uri: &str) -> (i32, String, String) { common::run( @@ -122,7 +132,8 @@ async fn replacing_a_manifest_entry_is_reported_as_updated_only() { assert!( stderr.ends_with(&format!( " [update] {PURL} (replacing 00000000)\n\ - Saved 1 patch to ./.socket/manifest.json (1 updated).\n" + Saved 1 patch to {} (1 updated).\n", + manifest_label() )), "the replacement must be reported as one saved patch, an update, never also an add; \ stdout={stdout}\nstderr={stderr}" @@ -148,7 +159,7 @@ async fn a_brand_new_entry_is_still_reported_as_added() { assert_eq!(code, 0, "save-only add must succeed; stderr={stderr}"); assert!( - stderr.ends_with("Saved 1 patch to ./.socket/manifest.json.\n"), + stderr.ends_with(&format!("Saved 1 patch to {}.\n", manifest_label())), "a new entry must be reported as one saved patch; stdout={stdout}\nstderr={stderr}" ); assert!(