]> git.lizzy.rs Git - rust.git/commitdiff
Truncate output example to 10 lines
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Sun, 9 Oct 2016 12:14:49 +0000 (14:14 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 3 Feb 2017 10:08:19 +0000 (11:08 +0100)
src/librustdoc/test.rs

index a772a52da727ac32f403b6761daa72a656a79da8..bba9fa5ed7524e6e5c00d448c11881a405bbbeab 100644 (file)
@@ -178,9 +178,14 @@ 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, test);
+                       filename, line_number, original,
+                       trunc_test.join("\n"));
     let input = config::Input::Str {
         name: driver::anon_src(),
         input: new_test.to_owned(),