Fix tests for Windows.

This commit is contained in:
Sergio Benitez 2019-07-03 21:23:57 -07:00
parent dab891dfa1
commit 35753c4d53
5 changed files with 2 additions and 4 deletions

View File

@ -47,7 +47,7 @@ mod static_tests {
]; ];
fn assert_file(client: &Client, prefix: &str, path: &str, exists: bool) { fn assert_file(client: &Client, prefix: &str, path: &str, exists: bool) {
let full_path = format!("/{}", Path::new(prefix).join(path).display()); let full_path = format!("/{}/{}", prefix, path);
let mut response = client.get(full_path).dispatch(); let mut response = client.get(full_path).dispatch();
if exists { if exists {
assert_eq!(response.status(), Status::Ok); assert_eq!(response.status(), Status::Ok);

View File

@ -109,7 +109,7 @@ pub trait Normalize {
impl<T: AsRef<Path>> Normalize for T { impl<T: AsRef<Path>> Normalize for T {
#[cfg(windows)] #[cfg(windows)]
fn normalized_str(&self) -> Cow<str> { fn normalized_str(&self) -> Cow<'_, str> {
self.as_ref().to_string_lossy().replace('\\', "/").into() self.as_ref().to_string_lossy().replace('\\', "/").into()
} }

View File

@ -331,8 +331,6 @@ impl Config {
/// ///
/// # #[cfg(not(windows))] /// # #[cfg(not(windows))]
/// assert_eq!(config.root().unwrap(), Path::new("/var/my_app")); /// assert_eq!(config.root().unwrap(), Path::new("/var/my_app"));
/// # #[cfg(windows)]
/// assert_eq!(config.root().unwrap(), Path::new("C:\\var\\my_app"));
/// ``` /// ```
pub fn set_root<P: AsRef<Path>>(&mut self, path: P) { pub fn set_root<P: AsRef<Path>>(&mut self, path: P) {
self.root_path = Some(path.as_ref().into()); self.root_path = Some(path.as_ref().into());

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB