@@ -54,28 +54,8 @@ pub fn check(root_path: &Path, bless: bool, bad: &mut bool) {
5454 let testname =
5555 file_path. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) . split_once ( '.' ) . unwrap ( ) . 0 ;
5656 if ext == "stderr" || ext == "stdout" || ext == "fixed" {
57- // Test output filenames have one of the formats:
58- // ```
59- // $testname.stderr
60- // $testname.$mode.stderr
61- // $testname.$revision.stderr
62- // $testname.$revision.$mode.stderr
63- // ```
64- //
65- // For now, just make sure that there is a corresponding
66- // `$testname.rs` file.
67-
68- if !file_path. with_file_name ( testname) . with_extension ( "rs" ) . exists ( )
69- && !testname. contains ( "ignore-tidy" )
70- {
71- tidy_error ! ( bad, "Stray file with UI testing output: {:?}" , file_path) ;
72- }
73-
74- if let Ok ( metadata) = fs:: metadata ( file_path)
75- && metadata. len ( ) == 0
76- {
77- tidy_error ! ( bad, "Empty file with UI testing output: {:?}" , file_path) ;
78- }
57+ check_stray_output_snapshot ( bad, file_path, testname) ;
58+ check_empty_output_snapshot ( bad, file_path) ;
7959 }
8060
8161 if ext == "rs"
@@ -175,3 +155,30 @@ fn check_unexpected_extension(bad: &mut bool, file_path: &Path, ext: &str) {
175155 tidy_error ! ( bad, "file {} has unexpected extension {}" , file_path. display( ) , ext) ;
176156 }
177157}
158+
159+ fn check_stray_output_snapshot ( bad : & mut bool , file_path : & Path , testname : & str ) {
160+ // Test output filenames have one of the formats:
161+ // ```
162+ // $testname.stderr
163+ // $testname.$mode.stderr
164+ // $testname.$revision.stderr
165+ // $testname.$revision.$mode.stderr
166+ // ```
167+ //
168+ // For now, just make sure that there is a corresponding
169+ // `$testname.rs` file.
170+
171+ if !file_path. with_file_name ( testname) . with_extension ( "rs" ) . exists ( )
172+ && !testname. contains ( "ignore-tidy" )
173+ {
174+ tidy_error ! ( bad, "Stray file with UI testing output: {:?}" , file_path) ;
175+ }
176+ }
177+
178+ fn check_empty_output_snapshot ( bad : & mut bool , file_path : & Path ) {
179+ if let Ok ( metadata) = fs:: metadata ( file_path)
180+ && metadata. len ( ) == 0
181+ {
182+ tidy_error ! ( bad, "Empty file with UI testing output: {:?}" , file_path) ;
183+ }
184+ }
0 commit comments