Skip to content

Commit 59ac401

Browse files
Truncate output example to 10 lines
1 parent 902460d commit 59ac401

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/librustdoc/test.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,14 @@ fn runtest(test: &str, cratename: &str, cfgs: Vec<String>, libs: SearchPaths,
178178
original: &str, line_number: u32, filename: &str) {
179179
// the test harness wants its own `main` & top level functions, so
180180
// never wrap the test in `fn main() { ... }`
181+
let mut trunc_test = test.split("\n").take(11).collect::<Vec<&str>>();
182+
if trunc_test.len() == 11 {
183+
trunc_test[10] = "...";
184+
}
181185
let new_test = maketest(test, Some(cratename), as_test_harness, opts);
182186
let test = format!("Error on {}:{}\n\n```{}\n{}\n```\n",
183-
filename, line_number, original, test);
187+
filename, line_number, original,
188+
trunc_test.join("\n"));
184189
let input = config::Input::Str {
185190
name: driver::anon_src(),
186191
input: new_test.to_owned(),

0 commit comments

Comments
 (0)