diff --git a/tests/testsuite/features.rs b/tests/testsuite/features.rs index 9962d1d02..a06572588 100644 --- a/tests/testsuite/features.rs +++ b/tests/testsuite/features.rs @@ -1,10 +1,9 @@ use std::fs::File; use std::io::prelude::*; -use support::hamcrest::assert_that; use support::paths::CargoPathExt; use support::registry::Package; -use support::{basic_manifest, execs, project}; +use support::{basic_manifest, project}; #[test] fn invalid1() { @@ -423,7 +422,7 @@ fn no_feature_doesnt_build() { ", dir = p.url() )).run(); - assert_that(p.process(&p.bin("foo")), execs().with_stdout("")); + p.process(&p.bin("foo")).with_stdout("").run(); p.cargo("build --features bar") .with_stderr(format!( @@ -434,7 +433,7 @@ fn no_feature_doesnt_build() { ", dir = p.url() )).run(); - assert_that(p.process(&p.bin("foo")), execs().with_stdout("bar\n")); + p.process(&p.bin("foo")).with_stdout("bar\n").run(); } #[test] @@ -478,7 +477,7 @@ fn default_feature_pulled_in() { ", dir = p.url() )).run(); - assert_that(p.process(&p.bin("foo")), execs().with_stdout("bar\n")); + p.process(&p.bin("foo")).with_stdout("bar\n").run(); p.cargo("build --no-default-features") .with_stderr(format!( @@ -488,7 +487,7 @@ fn default_feature_pulled_in() { ", dir = p.url() )).run(); - assert_that(p.process(&p.bin("foo")), execs().with_stdout("")); + p.process(&p.bin("foo")).with_stdout("").run(); } #[test] diff --git a/tests/testsuite/freshness.rs b/tests/testsuite/freshness.rs index 37b18ff2e..570833a17 100644 --- a/tests/testsuite/freshness.rs +++ b/tests/testsuite/freshness.rs @@ -5,7 +5,7 @@ use support::hamcrest::{assert_that, existing_file}; use support::paths::CargoPathExt; use support::registry::Package; use support::sleep_ms; -use support::{basic_manifest, execs, path2url, project}; +use support::{basic_manifest, path2url, project}; #[test] fn modifying_and_moving() { @@ -435,7 +435,7 @@ fn changing_bin_features_caches_targets() { [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", ).run(); - assert_that(foo_proc("off1"), execs().with_stdout("feature off")); + foo_proc("off1").with_stdout("feature off").run(); p.cargo("build --features foo") .with_stderr( @@ -444,7 +444,7 @@ fn changing_bin_features_caches_targets() { [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", ).run(); - assert_that(foo_proc("on1"), execs().with_stdout("feature on")); + foo_proc("on1").with_stdout("feature on").run(); /* Targets should be cached from the first build */ @@ -454,7 +454,7 @@ fn changing_bin_features_caches_targets() { [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", ).run(); - assert_that(foo_proc("off2"), execs().with_stdout("feature off")); + foo_proc("off2").with_stdout("feature off").run(); p.cargo("build --features foo") .with_stderr( @@ -462,7 +462,7 @@ fn changing_bin_features_caches_targets() { [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", ).run(); - assert_that(foo_proc("on2"), execs().with_stdout("feature on")); + foo_proc("on2").with_stdout("feature on").run(); } #[test] diff --git a/tests/testsuite/git.rs b/tests/testsuite/git.rs index 5e9bd4441..3e057adab 100644 --- a/tests/testsuite/git.rs +++ b/tests/testsuite/git.rs @@ -700,7 +700,7 @@ fn two_revs_same_deps() { foo.cargo("build -v").run(); assert_that(&foo.bin("foo"), existing_file()); - assert_that(foo.process(&foo.bin("foo")), execs()); + foo.process(&foo.bin("foo")).run(); } #[test] @@ -1173,7 +1173,7 @@ fn stale_cached_version() { ).build(); foo.cargo("build").run(); - assert_that(foo.process(&foo.bin("foo")), execs()); + foo.process(&foo.bin("foo")).run(); // Update the repo, and simulate someone else updating the lockfile and then // us pulling it down. @@ -1223,7 +1223,7 @@ fn stale_cached_version() { bar = bar.url(), foo = foo.url() )).run(); - assert_that(foo.process(&foo.bin("foo")), execs()); + foo.process(&foo.bin("foo")).run(); } #[test] diff --git a/tests/testsuite/jobserver.rs b/tests/testsuite/jobserver.rs index 29156007c..d2d033307 100644 --- a/tests/testsuite/jobserver.rs +++ b/tests/testsuite/jobserver.rs @@ -2,8 +2,7 @@ use std::net::TcpListener; use std::process::Command; use std::thread; -use support::hamcrest::assert_that; -use support::{cargo_exe, execs, project}; +use support::{cargo_exe, project}; #[test] fn jobserver_exists() { @@ -150,13 +149,11 @@ all: drop((a2, a3)); }); - assert_that( - p.process(make) - .env("CARGO", cargo_exe()) - .env("ADDR", addr.to_string()) - .arg("-j2"), - execs(), - ); + p.process(make) + .env("CARGO", cargo_exe()) + .env("ADDR", addr.to_string()) + .arg("-j2") + .run(); child.join().unwrap(); } @@ -181,15 +178,15 @@ all: ", ).build(); - assert_that( - p.process(make).env("CARGO", cargo_exe()).arg("-j2"), - execs().with_stderr( + p.process(make) + .env("CARGO", cargo_exe()) + .arg("-j2") + .with_stderr( "\ warning: a `-j` argument was passed to Cargo but Cargo is also configured \ with an external jobserver in its environment, ignoring the `-j` parameter [COMPILING] [..] [FINISHED] [..] ", - ), - ); + ).run(); } diff --git a/tests/testsuite/support/mod.rs b/tests/testsuite/support/mod.rs index 2da3ef36a..8613e394c 100644 --- a/tests/testsuite/support/mod.rs +++ b/tests/testsuite/support/mod.rs @@ -374,10 +374,10 @@ impl Project { /// p.process(&p.bin("foo")), /// execs().with_stdout("bar\n"), /// ); - pub fn process>(&self, program: T) -> ProcessBuilder { + pub fn process>(&self, program: T) -> Execs { let mut p = ::support::process(program); p.cwd(self.root()); - p + execs().with_process_builder(p) } /// Create a `ProcessBuilder` to run cargo. @@ -385,9 +385,11 @@ impl Project { /// Example: /// p.cargo("build --bin foo").run(); pub fn cargo(&self, cmd: &str) -> Execs { - let mut p = self.process(&cargo_exe()); - split_and_add_args(&mut p, cmd); - execs().with_process_builder(p) + let mut execs = self.process(&cargo_exe()); + if let Some(ref mut p) = execs.process_builder { + split_and_add_args(p, cmd); + } + execs } /// Returns the contents of `Cargo.lock`. @@ -1272,18 +1274,6 @@ impl<'t> ham::Matcher for &'t mut Execs { } } -impl<'a> ham::Matcher<&'a mut ProcessBuilder> for Execs { - fn matches(&self, process: &'a mut ProcessBuilder) -> ham::MatchResult { - self.match_process(process) - } -} - -impl<'a, 't> ham::Matcher<&'a mut ProcessBuilder> for &'t mut Execs { - fn matches(&self, process: &'a mut ProcessBuilder) -> ham::MatchResult { - self.match_process(process) - } -} - impl ham::Matcher for Execs { fn matches(&self, output: Output) -> ham::MatchResult { self.match_output(&output) diff --git a/tests/testsuite/test.rs b/tests/testsuite/test.rs index 9b1c7db67..7e45c8ff3 100644 --- a/tests/testsuite/test.rs +++ b/tests/testsuite/test.rs @@ -1722,10 +1722,9 @@ fn example_bin_same_name() { assert_that(&p.bin("foo"), is_not(existing_file())); assert_that(&p.bin("examples/foo"), existing_file()); - assert_that( - p.process(&p.bin("examples/foo")), - execs().with_stdout("example\n"), - ); + p.process(&p.bin("examples/foo")) + .with_stdout("example\n") + .run(); p.cargo("run") .with_stderr(