diff --git a/tests/support/mod.rs b/tests/support/mod.rs index 39f5eef86a4..ed802533c9a 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -12,6 +12,8 @@ use ham = hamcrest; use cargo::util::{process,ProcessBuilder}; use cargo::util::ProcessError; +use support::paths::PathExt; + pub mod paths; /* @@ -107,7 +109,7 @@ impl ProjectBuilder { try!(mkdir_recursive(&self.root)); for file in self.files.iter() { - try!(file.mk()); + try!(file.mk()); } Ok(()) @@ -116,8 +118,7 @@ impl ProjectBuilder { fn rm_root(&self) -> Result<(), String> { if self.root.exists() { rmdir_recursive(&self.root) - } - else { + } else { Ok(()) } } @@ -137,7 +138,7 @@ pub fn mkdir_recursive(path: &Path) -> Result<(), String> { } pub fn rmdir_recursive(path: &Path) -> Result<(), String> { - fs::rmdir_recursive(path) + path.rm_rf() .with_err_msg(format!("could not rm directory; path={}", path.display())) } diff --git a/tests/test_cargo_test.rs b/tests/test_cargo_test.rs index ad47932e268..455b0ced638 100644 --- a/tests/test_cargo_test.rs +++ b/tests/test_cargo_test.rs @@ -1,4 +1,4 @@ -use support::{project, execs, basic_bin_manifest, COMPILING}; +use support::{project, execs, basic_bin_manifest, COMPILING, cargo_dir}; use hamcrest::{assert_that, existing_file}; use cargo::util::process; @@ -28,13 +28,13 @@ test!(cargo_test_simple { process(p.bin("foo")), execs().with_stdout("hello\n")); - assert_that(p.cargo_process("cargo-test"), + assert_that(p.process(cargo_dir().join("cargo-test")), execs().with_stdout(format!("{} foo v0.5.0 (file:{})\n\n\ running 1 test\n\ test test_hello ... ok\n\n\ test result: ok. 1 passed; 0 failed; \ 0 ignored; 0 measured\n\n", COMPILING, p.root().display()))); - + assert_that(&p.bin("tests/foo"), existing_file()); })