@@ -213,12 +213,13 @@ fn run_valgrind_test(config: &Config, props: &TestProps, testpaths: &TestPaths)
213
213
}
214
214
215
215
fn 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
+ }
221
218
219
+ fn run_pretty_test_revision ( config : & Config ,
220
+ props : & TestProps ,
221
+ testpaths : & TestPaths ,
222
+ revision : Option < & str > ) {
222
223
if props. pp_exact . is_some ( ) {
223
224
logv ( config, "testing for exact pretty-printing" . to_owned ( ) ) ;
224
225
} else {
@@ -234,16 +235,18 @@ fn run_pretty_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
234
235
235
236
let mut round = 0 ;
236
237
while round < rounds {
237
- logv ( config, format ! ( "pretty-printing round {}" , round) ) ;
238
+ logv ( config, format ! ( "pretty-printing round {} revision {:?}" ,
239
+ round, revision) ) ;
238
240
let proc_res = print_source ( config,
239
241
props,
240
242
testpaths,
241
243
srcs[ round] . to_owned ( ) ,
242
244
& props. pretty_mode ) ;
243
245
244
246
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) ,
247
250
& proc_res) ;
248
251
}
249
252
@@ -270,30 +273,30 @@ fn run_pretty_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
270
273
expected = expected. replace ( & cr, "" ) . to_owned ( ) ;
271
274
}
272
275
273
- compare_source ( & expected, & actual) ;
276
+ compare_source ( revision , & expected, & actual) ;
274
277
275
278
// If we're only making sure that the output matches then just stop here
276
279
if props. pretty_compare_only { return ; }
277
280
278
281
// Finally, let's make sure it actually appears to remain valid code
279
282
let proc_res = typecheck_source ( config, props, testpaths, actual) ;
280
-
281
283
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) ;
283
285
}
286
+
284
287
if !props. pretty_expanded { return }
285
288
286
289
// additionally, run `--pretty expanded` and try to build it.
287
290
let proc_res = print_source ( config, props, testpaths, srcs[ round] . clone ( ) , "expanded" ) ;
288
291
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) ;
290
293
}
291
294
292
295
let ProcRes { stdout : expanded_src, .. } = proc_res;
293
296
let proc_res = typecheck_source ( config, props, testpaths, expanded_src) ;
294
297
if !proc_res. status . success ( ) {
295
298
fatal_proc_rec (
296
- None ,
299
+ revision ,
297
300
"pretty-printed source (expanded) does not typecheck" ,
298
301
& proc_res) ;
299
302
}
@@ -339,9 +342,9 @@ fn run_pretty_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
339
342
} ;
340
343
}
341
344
342
- fn compare_source ( expected : & str , actual : & str ) {
345
+ fn compare_source ( revision : Option < & str > , expected : & str , actual : & str ) {
343
346
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" ) ;
345
348
println ! ( "\n \
346
349
expected:\n \
347
350
------------------------------------------\n \
0 commit comments