report doctest compile failures correctly
This commit is contained in:
parent
33654195a1
commit
41e7ac16c4
3 changed files with 41 additions and 25 deletions
|
@ -260,7 +260,7 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
|
|||
let old = io::set_panic(Some(box Sink(data.clone())));
|
||||
let _bomb = Bomb(data.clone(), old.unwrap_or(box io::stdout()));
|
||||
|
||||
let (libdir, outdir) = driver::spawn_thread_pool(sessopts, |sessopts| {
|
||||
let (libdir, outdir, compile_result) = driver::spawn_thread_pool(sessopts, |sessopts| {
|
||||
let codemap = Lrc::new(CodeMap::new_doctest(
|
||||
sessopts.file_path_mapping(), filename.clone(), line as isize - line_offset as isize
|
||||
));
|
||||
|
@ -314,6 +314,9 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
|
|||
Err(_) | Ok(Err(CompileIncomplete::Errored(_))) => Err(())
|
||||
};
|
||||
|
||||
(libdir, outdir, compile_result)
|
||||
});
|
||||
|
||||
match (compile_result, compile_fail) {
|
||||
(Ok(()), true) => {
|
||||
panic!("test compiled while it wasn't supposed to")
|
||||
|
@ -334,9 +337,6 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
|
|||
panic!("Some expected error codes were not found: {:?}", error_codes);
|
||||
}
|
||||
|
||||
(libdir, outdir)
|
||||
});
|
||||
|
||||
if no_run { return }
|
||||
|
||||
// Run the code!
|
||||
|
|
|
@ -17,3 +17,8 @@
|
|||
/// panic!("oh no");
|
||||
/// ```
|
||||
pub struct SomeStruct;
|
||||
|
||||
/// ```
|
||||
/// no
|
||||
/// ```
|
||||
pub struct OtherStruct;
|
||||
|
|
|
@ -1,9 +1,20 @@
|
|||
|
||||
running 1 test
|
||||
running 2 tests
|
||||
test src/test/rustdoc-ui/failed-doctest-output.rs - OtherStruct (line 21) ... FAILED
|
||||
test src/test/rustdoc-ui/failed-doctest-output.rs - SomeStruct (line 16) ... FAILED
|
||||
|
||||
failures:
|
||||
|
||||
---- src/test/rustdoc-ui/failed-doctest-output.rs - OtherStruct (line 21) stdout ----
|
||||
error[E0425]: cannot find value `no` in this scope
|
||||
--> src/test/rustdoc-ui/failed-doctest-output.rs:22:1
|
||||
|
|
||||
3 | no
|
||||
| ^^ not found in this scope
|
||||
|
||||
thread 'src/test/rustdoc-ui/failed-doctest-output.rs - OtherStruct (line 21)' panicked at 'couldn't compile the test', librustdoc/test.rs:332:13
|
||||
note: Run with `RUST_BACKTRACE=1` for a backtrace.
|
||||
|
||||
---- src/test/rustdoc-ui/failed-doctest-output.rs - SomeStruct (line 16) stdout ----
|
||||
thread 'src/test/rustdoc-ui/failed-doctest-output.rs - SomeStruct (line 16)' panicked at 'test executable failed:
|
||||
|
||||
|
@ -11,11 +22,11 @@ thread 'main' panicked at 'oh no', src/test/rustdoc-ui/failed-doctest-output.rs:
|
|||
note: Run with `RUST_BACKTRACE=1` for a backtrace.
|
||||
|
||||
', librustdoc/test.rs:367:17
|
||||
note: Run with `RUST_BACKTRACE=1` for a backtrace.
|
||||
|
||||
|
||||
failures:
|
||||
src/test/rustdoc-ui/failed-doctest-output.rs - OtherStruct (line 21)
|
||||
src/test/rustdoc-ui/failed-doctest-output.rs - SomeStruct (line 16)
|
||||
|
||||
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
|
||||
test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue