@@ -526,38 +526,7 @@ impl TestProps {
526
526
self . check_test_line_numbers_match = config. parse_check_test_line_numbers_match ( ln) ;
527
527
}
528
528
529
- let check_no_run = |s| {
530
- if config. mode != Mode :: Ui && config. mode != Mode :: Incremental {
531
- panic ! ( "`{}` header is only supported in UI and incremental tests" , s) ;
532
- }
533
- if config. mode == Mode :: Incremental &&
534
- !cfg. map_or ( false , |r| r. starts_with ( "cfail" ) ) &&
535
- !self . revisions . iter ( ) . all ( |r| r. starts_with ( "cfail" ) ) {
536
- panic ! ( "`{}` header is only supported in `cfail` incremental tests" , s) ;
537
- }
538
- } ;
539
- let pass_mode = if config. parse_name_directive ( ln, "check-pass" ) {
540
- check_no_run ( "check-pass" ) ;
541
- Some ( PassMode :: Check )
542
- } else if config. parse_name_directive ( ln, "build-pass" ) {
543
- check_no_run ( "build-pass" ) ;
544
- Some ( PassMode :: Build )
545
- } else if config. parse_name_directive ( ln, "compile-pass" ) /* compatibility */ {
546
- check_no_run ( "compile-pass" ) ;
547
- Some ( PassMode :: Build )
548
- } else if config. parse_name_directive ( ln, "run-pass" ) {
549
- if config. mode != Mode :: Ui && config. mode != Mode :: RunPass /* compatibility */ {
550
- panic ! ( "`run-pass` header is only supported in UI tests" )
551
- }
552
- Some ( PassMode :: Run )
553
- } else {
554
- None
555
- } ;
556
- match ( self . pass_mode , pass_mode) {
557
- ( None , Some ( _) ) => self . pass_mode = pass_mode,
558
- ( Some ( _) , Some ( _) ) => panic ! ( "multiple `*-pass` headers in a single test" ) ,
559
- ( _, None ) => { }
560
- }
529
+ self . update_pass_mode ( ln, cfg, config) ;
561
530
562
531
if !self . disable_ui_testing_normalization {
563
532
self . disable_ui_testing_normalization =
@@ -604,6 +573,41 @@ impl TestProps {
604
573
}
605
574
}
606
575
}
576
+
577
+ fn update_pass_mode ( & mut self , ln : & str , revision : Option < & str > , config : & Config ) {
578
+ let check_no_run = |s| {
579
+ if config. mode != Mode :: Ui && config. mode != Mode :: Incremental {
580
+ panic ! ( "`{}` header is only supported in UI and incremental tests" , s) ;
581
+ }
582
+ if config. mode == Mode :: Incremental &&
583
+ !revision. map_or ( false , |r| r. starts_with ( "cfail" ) ) &&
584
+ !self . revisions . iter ( ) . all ( |r| r. starts_with ( "cfail" ) ) {
585
+ panic ! ( "`{}` header is only supported in `cfail` incremental tests" , s) ;
586
+ }
587
+ } ;
588
+ let pass_mode = if config. parse_name_directive ( ln, "check-pass" ) {
589
+ check_no_run ( "check-pass" ) ;
590
+ Some ( PassMode :: Check )
591
+ } else if config. parse_name_directive ( ln, "build-pass" ) {
592
+ check_no_run ( "build-pass" ) ;
593
+ Some ( PassMode :: Build )
594
+ } else if config. parse_name_directive ( ln, "compile-pass" ) /* compatibility */ {
595
+ check_no_run ( "compile-pass" ) ;
596
+ Some ( PassMode :: Build )
597
+ } else if config. parse_name_directive ( ln, "run-pass" ) {
598
+ if config. mode != Mode :: Ui && config. mode != Mode :: RunPass /* compatibility */ {
599
+ panic ! ( "`run-pass` header is only supported in UI tests" )
600
+ }
601
+ Some ( PassMode :: Run )
602
+ } else {
603
+ None
604
+ } ;
605
+ match ( self . pass_mode , pass_mode) {
606
+ ( None , Some ( _) ) => self . pass_mode = pass_mode,
607
+ ( Some ( _) , Some ( _) ) => panic ! ( "multiple `*-pass` headers in a single test" ) ,
608
+ ( _, None ) => { }
609
+ }
610
+ }
607
611
}
608
612
609
613
fn iter_header ( testfile : & Path , cfg : Option < & str > , it : & mut dyn FnMut ( & str ) ) {
0 commit comments