Skip to content

Commit d93b2d7

Browse files
committed
test --quiet option with and without harness
1 parent 805acff commit d93b2d7

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

tests/testsuite/test.rs

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,79 @@ fn cargo_test_overflow_checks() {
144144
p.process(&p.release_bin("foo")).with_stdout("").run();
145145
}
146146

147+
#[test]
148+
fn cargo_test_quiet_with_harness() {
149+
let p = project()
150+
.file(
151+
"Cargo.toml",
152+
r#"
153+
[package]
154+
name = "foo"
155+
version = "0.1.0"
156+
authors = []
157+
158+
[[test]]
159+
name = "foo"
160+
path = "src/foo.rs"
161+
harness = true
162+
"#,
163+
)
164+
.file(
165+
"src/foo.rs",
166+
r#"
167+
fn main() {}
168+
#[test] fn test_hello() {}
169+
"#,
170+
).build();
171+
172+
p.cargo("test -q")
173+
.with_stdout(
174+
"
175+
running 1 test
176+
.
177+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
178+
179+
"
180+
).with_stderr("")
181+
.run();
182+
}
183+
184+
#[test]
185+
fn cargo_test_quiet_no_harness() {
186+
let p = project()
187+
.file(
188+
"Cargo.toml",
189+
r#"
190+
[package]
191+
name = "foo"
192+
version = "0.1.0"
193+
authors = []
194+
195+
[[bin]]
196+
name = "foo"
197+
test = false
198+
199+
[[test]]
200+
name = "foo"
201+
path = "src/main.rs"
202+
harness = false
203+
"#,
204+
)
205+
.file(
206+
"src/main.rs",
207+
r#"
208+
fn main() {}
209+
#[test] fn test_hello() {}
210+
"#,
211+
).build();
212+
213+
p.cargo("test -q")
214+
.with_stdout(
215+
""
216+
).with_stderr("")
217+
.run();
218+
}
219+
147220
#[test]
148221
fn cargo_test_verbose() {
149222
let p = project()

0 commit comments

Comments
 (0)