mirror of https://github.com/rwf2/Rocket.git
Fix tests for Windows.
This commit is contained in:
parent
dab891dfa1
commit
35753c4d53
|
@ -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);
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 |
Loading…
Reference in New Issue