Skip to content

Commit 5881e22

Browse files
committed
Patch tidy to account for //@ style UI tests
1 parent 28bc605 commit 5881e22

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/tools/tidy/src/style.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,14 @@ const ANNOTATIONS_TO_IGNORE: &[&str] = &[
5555
"// CHECK",
5656
"// EMIT_MIR",
5757
"// compile-flags",
58+
"//@ compile-flags",
5859
"// error-pattern",
60+
"//@ error-pattern",
5961
"// gdb",
6062
"// lldb",
6163
"// cdb",
6264
"// normalize-stderr-test",
65+
"//@ normalize-stderr-test",
6366
];
6467

6568
// Intentionally written in decimal rather than hex
@@ -128,7 +131,15 @@ fn should_ignore(line: &str) -> bool {
128131
// This mirrors the regex in src/tools/compiletest/src/runtest.rs, please
129132
// update both if either are changed.
130133
let re = Regex::new("\\s*//(\\[.*\\])?~.*").unwrap();
131-
re.is_match(line) || ANNOTATIONS_TO_IGNORE.iter().any(|a| line.contains(a))
134+
// For `ui_test`-style UI test directives, also ignore
135+
// - `//@[rev] compile-flags`
136+
// - `//@[rev] normalize-stderr-test`
137+
let ui_test_long_directives =
138+
Regex::new("\\s*//@(\\[.*\\]) (compile-flags|normalize-stderr-test|error-pattern).*")
139+
.unwrap();
140+
re.is_match(line)
141+
|| ANNOTATIONS_TO_IGNORE.iter().any(|a| line.contains(a))
142+
|| ui_test_long_directives.is_match(line)
132143
}
133144

134145
/// Returns `true` if `line` is allowed to be longer than the normal limit.

src/tools/tidy/src/ui_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::path::{Path, PathBuf};
1515
const ENTRY_LIMIT: usize = 900;
1616
// FIXME: The following limits should be reduced eventually.
1717
const ISSUES_ENTRY_LIMIT: usize = 1794;
18-
const ROOT_ENTRY_LIMIT: usize = 870;
18+
const ROOT_ENTRY_LIMIT: usize = 871;
1919

2020
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
2121
"rs", // test source files

0 commit comments

Comments
 (0)