Rollup merge of #147429 - chenyukang:yukang-fix-test-tip, r=fmease
Print tip for human error format in runtest When working on https://github.com/rust-lang/rust/pull/147354, spent some time to figure out that there is `//~ ERROR` left on test file, this PR will give a better error message for this scenario.
This commit is contained in:
commit
2d353c35e8
1 changed files with 15 additions and 0 deletions
|
|
@ -878,6 +878,21 @@ impl<'test> TestCx<'test> {
|
|||
prefix = self.error_prefix(),
|
||||
n = not_found.len(),
|
||||
);
|
||||
|
||||
// FIXME: Ideally, we should check this at the place where we actually parse error annotations.
|
||||
// it's better to use (negated) heuristic inside normalize_output if possible
|
||||
if let Some(human_format) = self.props.compile_flags.iter().find(|flag| {
|
||||
// `human`, `human-unicode`, `short` will not generate JSON output
|
||||
flag.contains("error-format")
|
||||
&& (flag.contains("short") || flag.contains("human"))
|
||||
}) {
|
||||
let msg = format!(
|
||||
"tests with compile flag `{}` should not have error annotations such as `//~ ERROR`",
|
||||
human_format
|
||||
).color(Color::Red);
|
||||
writeln!(self.stdout, "{}", msg);
|
||||
}
|
||||
|
||||
for error in ¬_found {
|
||||
print_error(error);
|
||||
let mut suggestions = Vec::new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue