Skip to content

Commit 64657ee

Browse files
Fix path separators in three Windows test groups (#2177) (#2179)
* Start Windows test path separator fix Refs #2177. Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeSxwTj97uP4xQonHdq * Fix path separators in Windows test groups Three groups of tests failed on Windows in the nightly run. Each one built the path it expects from a '/'-separated string and compared it as text with a path made component by component: - gem_refresh: the rm command of a shared gem home joined "specifications/rack-1.0.0.gemspec" in one piece, where the product joins the directory and the file name. - Java gem e2e: vendor_rel kept the '/' of the strings gem_dir was joined from, where the directory walk yields '\'. - get update summary e2e: the save line names the manifest as --cwd joined with the manifest path, '.\.socket/manifest.json' on Windows. The tests now build their expected paths the way the other side does. No product code changes. Fixes #2177 Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011f9aeSxwTj97uP4xQonHdq --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent ecba20e commit 64657ee

3 files changed

Lines changed: 21 additions & 11 deletions

File tree

‎crates/socket-patch-cli/src/commands/gem_refresh.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,10 +1675,10 @@ mod tests {
16751675
`rm -f {} {} {} {} && bundle install`; another project that still pins \
16761676
the hosted patch of them then loads the upstream code, which \
16771677
`socket-patch scan` reports there.",
1678-
shell_word(&home.join("specifications/rack-1.0.0.gemspec")),
1679-
shell_word(&home.join("cache/rack-1.0.0.gem")),
1680-
shell_word(&home.join("specifications/rexml-1.0.0.gemspec")),
1681-
shell_word(&home.join("cache/rexml-1.0.0.gem")),
1678+
shell_word(&home.join("specifications").join("rack-1.0.0.gemspec")),
1679+
shell_word(&home.join("cache").join("rack-1.0.0.gem")),
1680+
shell_word(&home.join("specifications").join("rexml-1.0.0.gemspec")),
1681+
shell_word(&home.join("cache").join("rexml-1.0.0.gem")),
16821682
),
16831683
]
16841684
);

‎crates/socket-patch-cli/tests/e2e_gem_native_ext_build.rs‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3183,11 +3183,10 @@ impl JavaGem {
31833183

31843184
/// The gem file `file` as [`walk_files`] of `vendor/` names it.
31853185
fn vendor_rel(&self, file: &str) -> String {
3186-
let mut path = self
3187-
.gem_dir
3188-
.strip_prefix(self.proj.join("vendor"))
3189-
.unwrap()
3190-
.to_path_buf();
3186+
// Component by component: `gem_dir` was joined from `/` strings,
3187+
// and Windows would keep those separators where the walk has `\`.
3188+
let rel = self.gem_dir.strip_prefix(self.proj.join("vendor")).unwrap();
3189+
let mut path: PathBuf = rel.components().collect();
31913190
path.extend(file.split('/'));
31923191
path.display().to_string()
31933192
}

‎crates/socket-patch-cli/tests/get/get_update_summary_e2e.rs‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ async fn mount_mocks(mock: &MockServer) {
8888
.await;
8989
}
9090

91+
/// The manifest as the save line names it: the default `--cwd` (`.`) joined
92+
/// with the default manifest path, so `./.socket/manifest.json` on Unix and
93+
/// `.\.socket/manifest.json` on Windows.
94+
fn manifest_label() -> String {
95+
std::path::Path::new(".")
96+
.join(".socket/manifest.json")
97+
.display()
98+
.to_string()
99+
}
100+
91101
/// Run `get <PURL> --save-only` against `mock`, returning `(code, stdout, stderr)`.
92102
fn run_get(cwd: &std::path::Path, uri: &str) -> (i32, String, String) {
93103
common::run(
@@ -122,7 +132,8 @@ async fn replacing_a_manifest_entry_is_reported_as_updated_only() {
122132
assert!(
123133
stderr.ends_with(&format!(
124134
" [update] {PURL} (replacing 00000000)\n\
125-
Saved 1 patch to ./.socket/manifest.json (1 updated).\n"
135+
Saved 1 patch to {} (1 updated).\n",
136+
manifest_label()
126137
)),
127138
"the replacement must be reported as one saved patch, an update, never also an add; \
128139
stdout={stdout}\nstderr={stderr}"
@@ -148,7 +159,7 @@ async fn a_brand_new_entry_is_still_reported_as_added() {
148159
assert_eq!(code, 0, "save-only add must succeed; stderr={stderr}");
149160

150161
assert!(
151-
stderr.ends_with("Saved 1 patch to ./.socket/manifest.json.\n"),
162+
stderr.ends_with(&format!("Saved 1 patch to {}.\n", manifest_label())),
152163
"a new entry must be reported as one saved patch; stdout={stdout}\nstderr={stderr}"
153164
);
154165
assert!(

0 commit comments

Comments
 (0)