rustdoc: output stderr on doc-test fail

Forward output from stderr when a test executable panics/fails.
This commit is contained in:
ray glover 2015-03-30 17:59:28 +01:00
parent c5370be36e
commit 5dc23be5b1
1 changed files with 3 additions and 2 deletions

View File

@ -243,8 +243,9 @@ fn runtest(test: &str, cratename: &str, libs: SearchPaths,
if should_panic && out.status.success() {
panic!("test executable succeeded when it should have failed");
} else if !should_panic && !out.status.success() {
panic!("test executable failed:\n{:?}",
str::from_utf8(&out.stdout));
panic!("test executable failed:\n{}\n{}",
str::from_utf8(&out.stdout).unwrap_or(""),
str::from_utf8(&out.stderr).unwrap_or(""));
}
}
}