@@ -58,27 +58,14 @@ pub fn check(root_path: &Path, bless: bool, bad: &mut bool) {
5858 check_empty_output_snapshot ( bad, file_path) ;
5959 }
6060
61- if ext == "rs"
62- && let Some ( test_name) = static_regex ! ( r"^issues?[-_]?(\d{3,})" ) . captures ( testname)
63- {
64- // these paths are always relative to the passed `path` and always UTF8
65- let stripped_path = file_path
66- . strip_prefix ( path)
67- . unwrap ( )
68- . to_str ( )
69- . unwrap ( )
70- . replace ( std:: path:: MAIN_SEPARATOR_STR , "/" ) ;
71-
72- if !remaining_issue_names. remove ( stripped_path. as_str ( ) )
73- && !stripped_path. starts_with ( "ui/issues/" )
74- {
75- tidy_error ! (
76- bad,
77- "file `tests/{stripped_path}` must begin with a descriptive name, consider `{{reason}}-issue-{issue_n}.rs`" ,
78- issue_n = & test_name[ 1 ] ,
79- ) ;
80- }
81- }
61+ deny_new_nondescriptive_test_names (
62+ bad,
63+ path,
64+ & mut remaining_issue_names,
65+ file_path,
66+ testname,
67+ ext,
68+ ) ;
8269 }
8370 } ) ;
8471
@@ -182,3 +169,34 @@ fn check_empty_output_snapshot(bad: &mut bool, file_path: &Path) {
182169 tidy_error ! ( bad, "Empty file with UI testing output: {:?}" , file_path) ;
183170 }
184171}
172+
173+ fn deny_new_nondescriptive_test_names (
174+ bad : & mut bool ,
175+ path : & Path ,
176+ remaining_issue_names : & mut BTreeSet < & str > ,
177+ file_path : & Path ,
178+ testname : & str ,
179+ ext : & str ,
180+ ) {
181+ if ext == "rs"
182+ && let Some ( test_name) = static_regex ! ( r"^issues?[-_]?(\d{3,})" ) . captures ( testname)
183+ {
184+ // these paths are always relative to the passed `path` and always UTF8
185+ let stripped_path = file_path
186+ . strip_prefix ( path)
187+ . unwrap ( )
188+ . to_str ( )
189+ . unwrap ( )
190+ . replace ( std:: path:: MAIN_SEPARATOR_STR , "/" ) ;
191+
192+ if !remaining_issue_names. remove ( stripped_path. as_str ( ) )
193+ && !stripped_path. starts_with ( "ui/issues/" )
194+ {
195+ tidy_error ! (
196+ bad,
197+ "file `tests/{stripped_path}` must begin with a descriptive name, consider `{{reason}}-issue-{issue_n}.rs`" ,
198+ issue_n = & test_name[ 1 ] ,
199+ ) ;
200+ }
201+ }
202+ }
0 commit comments