tidy/rustdoc_gui_tests.rs
1//! Tidy check to ensure that rustdoc GUI tests start with a small description.
2
3use std::path::Path;
4
5pub fn check(path: &Path, bad: &mut bool) {
6 crate::walk::walk(
7 &path.join("rustdoc-gui"),
8 |p, is_dir| !is_dir && p.extension().is_none_or(|e| e != "goml"),
9 &mut |entry, content| {
10 for line in content.lines() {
11 if !line.starts_with("// ") {
12 tidy_error!(
13 bad,
14 "{}: rustdoc-gui tests must start with a small description",
15 entry.path().display(),
16 );
17 return;
18 } else if line.starts_with("// ") {
19 let parts = line[2..].trim();
20 // We ignore tidy comments.
21 if parts.starts_with("// tidy-") {
22 continue;
23 }
24 // All good!
25 return;
26 }
27 }
28 },
29 );
30}