@@ -213,12 +213,13 @@ fn run_valgrind_test(config: &Config, props: &TestProps, testpaths: &TestPaths)
213213}
214214
215215fn run_pretty_test ( config : & Config , props : & TestProps , testpaths : & TestPaths ) {
216- // Note: because we run the --pretty tests on the code in run-pass etc,
217- // we may see a list of revisions -- but we can just ignore them.
218- // We cannot assert that the list is empty as we do elsewhere.
219- //
220- // assert!(props.revisions.is_empty(), "revisions not relevant here");
216+ for_each_revision ( config, props, testpaths, run_pretty_test_revision) ;
217+ }
221218
219+ fn run_pretty_test_revision ( config : & Config ,
220+ props : & TestProps ,
221+ testpaths : & TestPaths ,
222+ revision : Option < & str > ) {
222223 if props. pp_exact . is_some ( ) {
223224 logv ( config, "testing for exact pretty-printing" . to_owned ( ) ) ;
224225 } else {
@@ -234,16 +235,18 @@ fn run_pretty_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
234235
235236 let mut round = 0 ;
236237 while round < rounds {
237- logv ( config, format ! ( "pretty-printing round {}" , round) ) ;
238+ logv ( config, format ! ( "pretty-printing round {} revision {:?}" ,
239+ round, revision) ) ;
238240 let proc_res = print_source ( config,
239241 props,
240242 testpaths,
241243 srcs[ round] . to_owned ( ) ,
242244 & props. pretty_mode ) ;
243245
244246 if !proc_res. status . success ( ) {
245- fatal_proc_rec ( None ,
246- & format ! ( "pretty-printing failed in round {}" , round) ,
247+ fatal_proc_rec ( revision,
248+ & format ! ( "pretty-printing failed in round {} revision {:?}" ,
249+ round, revision) ,
247250 & proc_res) ;
248251 }
249252
@@ -270,30 +273,30 @@ fn run_pretty_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
270273 expected = expected. replace ( & cr, "" ) . to_owned ( ) ;
271274 }
272275
273- compare_source ( & expected, & actual) ;
276+ compare_source ( revision , & expected, & actual) ;
274277
275278 // If we're only making sure that the output matches then just stop here
276279 if props. pretty_compare_only { return ; }
277280
278281 // Finally, let's make sure it actually appears to remain valid code
279282 let proc_res = typecheck_source ( config, props, testpaths, actual) ;
280-
281283 if !proc_res. status . success ( ) {
282- fatal_proc_rec ( None , "pretty-printed source does not typecheck" , & proc_res) ;
284+ fatal_proc_rec ( revision , "pretty-printed source does not typecheck" , & proc_res) ;
283285 }
286+
284287 if !props. pretty_expanded { return }
285288
286289 // additionally, run `--pretty expanded` and try to build it.
287290 let proc_res = print_source ( config, props, testpaths, srcs[ round] . clone ( ) , "expanded" ) ;
288291 if !proc_res. status . success ( ) {
289- fatal_proc_rec ( None , "pretty-printing (expanded) failed" , & proc_res) ;
292+ fatal_proc_rec ( revision , "pretty-printing (expanded) failed" , & proc_res) ;
290293 }
291294
292295 let ProcRes { stdout : expanded_src, .. } = proc_res;
293296 let proc_res = typecheck_source ( config, props, testpaths, expanded_src) ;
294297 if !proc_res. status . success ( ) {
295298 fatal_proc_rec (
296- None ,
299+ revision ,
297300 "pretty-printed source (expanded) does not typecheck" ,
298301 & proc_res) ;
299302 }
@@ -339,9 +342,9 @@ fn run_pretty_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
339342 } ;
340343 }
341344
342- fn compare_source ( expected : & str , actual : & str ) {
345+ fn compare_source ( revision : Option < & str > , expected : & str , actual : & str ) {
343346 if expected != actual {
344- error ( None , "pretty-printed source does not match expected source" ) ;
347+ error ( revision , "pretty-printed source does not match expected source" ) ;
345348 println ! ( "\n \
346349 expected:\n \
347350 ------------------------------------------\n \
0 commit comments