Skip to content
This repository was archived by the owner on Dec 29, 2021. It is now read-only.

Commit fae7c90

Browse files
committed
fix: Remove unrelated output in main_binary
We use cargo run behind the scenes to run the main binary but that should only be an implementation detail. Fixes #45
1 parent aa89b08 commit fae7c90

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/assert.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl default::Default for Assert {
2626
/// Defaults to asserting _successful_ execution.
2727
fn default() -> Self {
2828
Assert {
29-
cmd: vec!["cargo", "run", "--"]
29+
cmd: vec!["cargo", "run", "--quiet", "--"]
3030
.into_iter()
3131
.map(String::from)
3232
.collect(),
@@ -53,7 +53,7 @@ impl Assert {
5353
/// Defaults to asserting _successful_ execution.
5454
pub fn cargo_binary(name: &str) -> Self {
5555
Assert {
56-
cmd: vec!["cargo", "run", "--bin", name, "--"]
56+
cmd: vec!["cargo", "run", "--quiet", "--bin", name, "--"]
5757
.into_iter()
5858
.map(String::from)
5959
.collect(),

tests/cargo.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ fn main_binary() {
55
assert_cli::Assert::main_binary()
66
.with_env(assert_cli::Environment::inherit().insert("stdout", "42"))
77
.stdout()
8-
.contains("42")
8+
.is("42")
9+
.stderr()
10+
.is("")
911
.unwrap();
1012
}
1113

@@ -14,6 +16,8 @@ fn cargo_binary() {
1416
assert_cli::Assert::cargo_binary("assert_fixture")
1517
.with_env(assert_cli::Environment::inherit().insert("stdout", "42"))
1618
.stdout()
17-
.contains("42")
19+
.is("42")
20+
.stderr()
21+
.is("")
1822
.unwrap();
1923
}

0 commit comments

Comments
 (0)