Make tests build on CloudABI.
There are some tests that need to be disabled on CloudABI specifically, due to the fact that the shims cannot be built in combination with unix::ext or windows::ext. Also improve the scoping of some imports to suppress compiler warnings.
This commit is contained in:
@@ -956,8 +956,7 @@ mod arch {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use ffi::OsStr;
|
use path::Path;
|
||||||
use path::{Path, PathBuf};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_os = "emscripten", ignore)]
|
#[cfg_attr(target_os = "emscripten", ignore)]
|
||||||
@@ -980,6 +979,8 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn split_paths_windows() {
|
fn split_paths_windows() {
|
||||||
|
use path::PathBuf;
|
||||||
|
|
||||||
fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
|
fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
|
||||||
split_paths(unparsed).collect::<Vec<_>>() ==
|
split_paths(unparsed).collect::<Vec<_>>() ==
|
||||||
parsed.iter().map(|s| PathBuf::from(*s)).collect::<Vec<_>>()
|
parsed.iter().map(|s| PathBuf::from(*s)).collect::<Vec<_>>()
|
||||||
@@ -1000,6 +1001,8 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn split_paths_unix() {
|
fn split_paths_unix() {
|
||||||
|
use path::PathBuf;
|
||||||
|
|
||||||
fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
|
fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
|
||||||
split_paths(unparsed).collect::<Vec<_>>() ==
|
split_paths(unparsed).collect::<Vec<_>>() ==
|
||||||
parsed.iter().map(|s| PathBuf::from(*s)).collect::<Vec<_>>()
|
parsed.iter().map(|s| PathBuf::from(*s)).collect::<Vec<_>>()
|
||||||
@@ -1015,6 +1018,8 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn join_paths_unix() {
|
fn join_paths_unix() {
|
||||||
|
use ffi::OsStr;
|
||||||
|
|
||||||
fn test_eq(input: &[&str], output: &str) -> bool {
|
fn test_eq(input: &[&str], output: &str) -> bool {
|
||||||
&*join_paths(input.iter().cloned()).unwrap() ==
|
&*join_paths(input.iter().cloned()).unwrap() ==
|
||||||
OsStr::new(output)
|
OsStr::new(output)
|
||||||
@@ -1031,6 +1036,8 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn join_paths_windows() {
|
fn join_paths_windows() {
|
||||||
|
use ffi::OsStr;
|
||||||
|
|
||||||
fn test_eq(input: &[&str], output: &str) -> bool {
|
fn test_eq(input: &[&str], output: &str) -> bool {
|
||||||
&*join_paths(input.iter().cloned()).unwrap() ==
|
&*join_paths(input.iter().cloned()).unwrap() ==
|
||||||
OsStr::new(output)
|
OsStr::new(output)
|
||||||
|
|||||||
@@ -1981,7 +1981,7 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
|
||||||
mod tests {
|
mod tests {
|
||||||
use io::prelude::*;
|
use io::prelude::*;
|
||||||
|
|
||||||
|
|||||||
@@ -885,7 +885,7 @@ impl fmt::Debug for TcpListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
|
||||||
mod tests {
|
mod tests {
|
||||||
use io::ErrorKind;
|
use io::ErrorKind;
|
||||||
use io::prelude::*;
|
use io::prelude::*;
|
||||||
|
|||||||
@@ -786,7 +786,7 @@ impl fmt::Debug for UdpSocket {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
|
||||||
mod tests {
|
mod tests {
|
||||||
use io::ErrorKind;
|
use io::ErrorKind;
|
||||||
use net::*;
|
use net::*;
|
||||||
|
|||||||
@@ -1392,7 +1392,7 @@ pub fn id() -> u32 {
|
|||||||
::sys::os::getpid()
|
::sys::os::getpid()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(test, not(target_os = "emscripten")))]
|
#[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))]
|
||||||
mod tests {
|
mod tests {
|
||||||
use io::prelude::*;
|
use io::prelude::*;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user