From f2a02c1c21d4f82c08112423550587f04c7c5a01 Mon Sep 17 00:00:00 2001 From: kellda <59569234+kellda@users.noreply.github.com> Date: Fri, 5 Feb 2021 14:22:41 +0000 Subject: [PATCH] Fix tests --- src/utils/utils.rs | 2 +- tests/cli-paths.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/utils/utils.rs b/src/utils/utils.rs index 44ec0b4c11..71331830b4 100644 --- a/src/utils/utils.rs +++ b/src/utils/utils.rs @@ -739,7 +739,7 @@ impl<'a> io::Read for FileReaderWithProgress<'a> { // search user database to get home dir of euid user #[cfg(unix)] pub fn home_dir_from_passwd() -> Option { - use std::ffi::CStr; + use std::ffi::{CStr, OsString}; use std::mem::MaybeUninit; use std::os::unix::ffi::OsStringExt; use std::ptr; diff --git a/tests/cli-paths.rs b/tests/cli-paths.rs index baa6b3be08..f27e4c79f1 100644 --- a/tests/cli-paths.rs +++ b/tests/cli-paths.rs @@ -314,12 +314,15 @@ mod windows { fn install_uninstall_affect_path() { clitools::setup(Scenario::Empty, &|config| { with_saved_path(&|| { - let path = config.cargodir.join("bin").to_string_lossy().to_string(); + let path = format!("{:?}", config.cargodir.join("bin").to_string_lossy()); expect_ok(config, &INIT_NONE); assert!( - get_path().unwrap().to_string().contains(&path), - format!("`{}` not in `{}`", get_path().unwrap(), &path) + get_path() + .unwrap() + .to_string() + .contains(path.trim_matches('"')), + format!("`{}` not in `{}`", path, get_path().unwrap()) ); expect_ok(config, &["rustup", "self", "uninstall", "-y"]);