@@ -29,7 +29,7 @@ fn load_props(testfile: str) -> test_props {
29
29
let mut exec_env = [ ] ;
30
30
let mut compile_flags = option:: none;
31
31
let mut pp_exact = option:: none;
32
- iter_header ( testfile) { |ln|
32
+ for iter_header( testfile) { |ln|
33
33
alt parse_error_pattern( ln) {
34
34
option:: some( ep) { error_patterns += [ ep] ; }
35
35
option:: none { }
@@ -62,14 +62,11 @@ fn load_props(testfile: str) -> test_props {
62
62
63
63
fn is_test_ignored ( config : config , testfile : str ) -> bool {
64
64
let mut found = false ;
65
- iter_header ( testfile) { |ln|
66
- // FIXME: Can't return or break from iterator
67
- // (Fix when Issue #1619 is resolved)
68
- found = found || parse_name_directive ( ln, "xfail-test" ) ;
69
- found = found || parse_name_directive ( ln, xfail_target ( ) ) ;
70
- if ( config. mode == common:: mode_pretty) {
71
- found = found || parse_name_directive ( ln, "xfail-pretty" ) ;
72
- }
65
+ for iter_header( testfile) { |ln|
66
+ if parse_name_directive ( ln, "xfail-test" ) { ret true ; }
67
+ if parse_name_directive ( ln, xfail_target ( ) ) { ret true ; }
68
+ if config. mode == common:: mode_pretty &&
69
+ parse_name_directive ( ln, "xfail-pretty" ) { ret true ; }
73
70
} ;
74
71
ret found;
75
72
@@ -78,7 +75,7 @@ fn is_test_ignored(config: config, testfile: str) -> bool {
78
75
}
79
76
}
80
77
81
- fn iter_header ( testfile : str , it : fn ( str ) ) {
78
+ fn iter_header ( testfile : str , it : fn ( str ) -> bool ) -> bool {
82
79
let rdr = result:: get ( io:: file_reader ( testfile) ) ;
83
80
while !rdr. eof ( ) {
84
81
let ln = rdr. read_line ( ) ;
@@ -88,9 +85,10 @@ fn iter_header(testfile: str, it: fn(str)) {
88
85
// with a warm page cache. Maybe with a cold one.
89
86
if str:: starts_with ( ln, "fn" )
90
87
|| str:: starts_with ( ln, "mod" ) {
91
- break ;
92
- } else { it ( ln) ; }
88
+ ret false ;
89
+ } else { if ! ( it ( ln) ) { ret false ; } }
93
90
}
91
+ ret true;
94
92
}
95
93
96
94
fn parse_error_pattern ( line : str ) -> option < str > {
0 commit comments