diff --git a/src/cargo/ops/cargo_test.rs b/src/cargo/ops/cargo_test.rs index 8548087986c..42e365f6ae7 100644 --- a/src/cargo/ops/cargo_test.rs +++ b/src/cargo/ops/cargo_test.rs @@ -20,7 +20,7 @@ pub fn run_tests(manifest_path: &Path, return Ok(None) } let mut errors = if options.only_doc { - Vec::new() + try!(run_doc_tests(options, test_args, &compilation)) } else { try!(run_unit_tests(options, test_args, &compilation)) }; diff --git a/tests/test_cargo_test.rs b/tests/test_cargo_test.rs index 22b8241494f..cf6f50e8d45 100644 --- a/tests/test_cargo_test.rs +++ b/tests/test_cargo_test.rs @@ -2071,5 +2071,15 @@ test!(only_test_docs { p.build(); assert_that(p.cargo("test").arg("--doc"), - execs().with_status(0)); + execs().with_status(0).with_stdout(&format!("\ +[COMPILING] foo v0.0.1 ([..]) +[DOCTEST] foo + +running 1 test +test bar_0 ... ok + +test result: ok.[..] + +"))); }); +