From 7f2c9f426cd88b6e09022954570c448cab6403f7 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Wed, 3 Jul 2019 21:23:57 -0700 Subject: [PATCH] Fix tests for Windows. --- contrib/lib/tests/static_files.rs | 2 +- core/http/src/ext.rs | 2 +- core/lib/src/config/config.rs | 2 -- examples/static_files/static/rocket-icon.jpg | Bin 88512 -> 88511 bytes examples/todo/static/images/favicon.png | Bin 1156 -> 1155 bytes 5 files changed, 2 insertions(+), 4 deletions(-) diff --git a/contrib/lib/tests/static_files.rs b/contrib/lib/tests/static_files.rs index b5318d19..e204c377 100644 --- a/contrib/lib/tests/static_files.rs +++ b/contrib/lib/tests/static_files.rs @@ -44,7 +44,7 @@ mod static_tests { ]; 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(); if exists { assert_eq!(response.status(), Status::Ok); diff --git a/core/http/src/ext.rs b/core/http/src/ext.rs index 1f5eb5b1..157575ff 100644 --- a/core/http/src/ext.rs +++ b/core/http/src/ext.rs @@ -109,7 +109,7 @@ pub trait Normalize { impl> Normalize for T { #[cfg(windows)] - fn normalized_str(&self) -> Cow { + fn normalized_str(&self) -> Cow<'_, str> { self.as_ref().to_string_lossy().replace('\\', "/").into() } diff --git a/core/lib/src/config/config.rs b/core/lib/src/config/config.rs index 99d010c0..d07e680b 100644 --- a/core/lib/src/config/config.rs +++ b/core/lib/src/config/config.rs @@ -331,8 +331,6 @@ impl Config { /// /// # #[cfg(not(windows))] /// 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>(&mut self, path: P) { self.root_path = Some(path.as_ref().into()); diff --git a/examples/static_files/static/rocket-icon.jpg b/examples/static_files/static/rocket-icon.jpg index b6000fb0d4d9248ea688e585a463faad0fa419e1..405f1a402e7f1611249fc6c751379774e3c65c42 100644 GIT binary patch delta 14 WcmX@GnRWkW)(w9zZ2ouQPzL}&e+f7M delta 16 YcmdnLnf1VC)(w9zF!FBxd*M(A086I{MF0Q* diff --git a/examples/todo/static/images/favicon.png b/examples/todo/static/images/favicon.png index 7a3c81c1e32b4e4224452cf8261a585480caa0ea..02b7390443ae2877c186898f52da23f062adbdcc 100644 GIT binary patch delta 13 UcmZqSZ02O?4DfT`$Xd?=02R delta 14 VcmZqXY~f_>4DfU3-N;hU0stMN1JVEh