]> git.lizzy.rs Git - rust.git/commitdiff
compiletest: Filter away test annotations from UI test output
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sat, 9 Mar 2019 11:29:55 +0000 (14:29 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Mon, 11 Mar 2019 18:37:21 +0000 (21:37 +0300)
src/tools/compiletest/src/runtest.rs

index bac41a7c57904b1a9bb25ac5f5d396742584ceeb..68ecc0527bc7c326941e765f74db9bc774991f37 100644 (file)
@@ -3083,6 +3083,12 @@ fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> S
               .replace("\\", "/") // normalize for paths on windows
               .replace("\r\n", "\n") // normalize for linebreaks on windows
               .replace("\t", "\\t"); // makes tabs visible
+
+        // Remove test annotations like `//~ ERROR text` from the output,
+        // since they duplicate actual errors and make the output hard to read.
+        normalized = Regex::new("\\s*//~.*").unwrap()
+            .replace_all(&normalized, "").into_owned();
+
         for rule in custom_rules {
             let re = Regex::new(&rule.0).expect("bad regex in custom normalization rule");
             normalized = re.replace_all(&normalized, &rule.1[..]).into_owned();