Skip to content

Commit f2a02c1

Browse files
committed
Fix tests
1 parent 7fac19d commit f2a02c1

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/utils/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ impl<'a> io::Read for FileReaderWithProgress<'a> {
739739
// search user database to get home dir of euid user
740740
#[cfg(unix)]
741741
pub fn home_dir_from_passwd() -> Option<PathBuf> {
742-
use std::ffi::CStr;
742+
use std::ffi::{CStr, OsString};
743743
use std::mem::MaybeUninit;
744744
use std::os::unix::ffi::OsStringExt;
745745
use std::ptr;

tests/cli-paths.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,15 @@ mod windows {
314314
fn install_uninstall_affect_path() {
315315
clitools::setup(Scenario::Empty, &|config| {
316316
with_saved_path(&|| {
317-
let path = config.cargodir.join("bin").to_string_lossy().to_string();
317+
let path = format!("{:?}", config.cargodir.join("bin").to_string_lossy());
318318

319319
expect_ok(config, &INIT_NONE);
320320
assert!(
321-
get_path().unwrap().to_string().contains(&path),
322-
format!("`{}` not in `{}`", get_path().unwrap(), &path)
321+
get_path()
322+
.unwrap()
323+
.to_string()
324+
.contains(path.trim_matches('"')),
325+
format!("`{}` not in `{}`", path, get_path().unwrap())
323326
);
324327

325328
expect_ok(config, &["rustup", "self", "uninstall", "-y"]);

0 commit comments

Comments
 (0)