Rework rustdoc test output a bit

This commit is contained in:
Guillaume Gomez 2016-11-15 22:29:46 +01:00
parent 59ac401b39
commit 5fe3915a05
1 changed files with 4 additions and 9 deletions

View File

@ -178,18 +178,13 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
original: &str, line_number: u32, filename: &str) {
// the test harness wants its own `main` & top level functions, so
// never wrap the test in `fn main() { ... }`
let mut trunc_test = test.split("\n").take(11).collect::<Vec<&str>>();
if trunc_test.len() == 11 {
trunc_test[10] = "...";
}
let new_test = maketest(test, Some(cratename), as_test_harness, opts);
let test = format!("Error on {}:{}\n\n```{}\n{}\n```\n",
filename, line_number, original,
trunc_test.join("\n"));
let test = maketest(test, Some(cratename), as_test_harness, opts);
let input = config::Input::Str {
name: driver::anon_src(),
input: new_test.to_owned(),
input: test.to_owned(),
};
let test = format!("Error in \"{}\" at line {}.\n",
filename, line_number);
let outputs = OutputTypes::new(&[(OutputType::Exe, None)]);
let sessopts = config::Options {