From 4503b35e1a2749c935a8889dc223958177c12864 Mon Sep 17 00:00:00 2001 From: Vitaly Slobodin Date: Sun, 25 Jan 2026 00:05:13 +0100 Subject: [PATCH] test(bundler): Make tests path-separator agnostic --- src/bundler.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/bundler.rs b/src/bundler.rs index 7de3763..dfd8d7f 100644 --- a/src/bundler.rs +++ b/src/bundler.rs @@ -78,6 +78,7 @@ mod tests { use super::*; use crate::command_executor::CommandExecutor; use std::cell::RefCell; + use std::path::Path; use zed_extension_api::process::Output; struct MockExecutorConfig { @@ -158,7 +159,10 @@ mod tests { gem: &str, ) -> MockCommandExecutor { let mock = MockCommandExecutor::new(); - let gemfile_path = format!("{dir}/Gemfile"); + let gemfile_path = Path::new(dir) + .join("Gemfile") + .to_string_lossy() + .into_owned(); mock.expect( "bundle", &["info", "--version", gem], @@ -187,12 +191,15 @@ mod tests { let mock_executor = MockCommandExecutor::new(); let gem_name = "unknown_gem"; let error_output = "Could not find gem 'unknown_gem'."; - let gemfile_path = "test_dir/Gemfile"; + let gemfile_path = Path::new("test_dir") + .join("Gemfile") + .to_string_lossy() + .into_owned(); mock_executor.expect( "bundle", &["info", "--version", gem_name], - &[("BUNDLE_GEMFILE", gemfile_path)], + &[("BUNDLE_GEMFILE", &gemfile_path)], Ok(Output { status: Some(1), stdout: Vec::new(), @@ -223,12 +230,15 @@ mod tests { let mock_executor = MockCommandExecutor::new(); let gem_name = "critical_gem"; let specific_error_msg = "Mocked execution failure"; - let gemfile_path = "test_dir/Gemfile"; + let gemfile_path = Path::new("test_dir") + .join("Gemfile") + .to_string_lossy() + .into_owned(); mock_executor.expect( "bundle", &["info", "--version", gem_name], - &[("BUNDLE_GEMFILE", gemfile_path)], + &[("BUNDLE_GEMFILE", &gemfile_path)], Err(specific_error_msg.to_string()), );