@@ -125,16 +125,33 @@ fn make_tests(cx: &cx) -> tests_and_conv_fn {
125
125
let tests = ~[ ] ;
126
126
for file: str in fs:: list_dir ( cx. config . src_base ) {
127
127
log #fmt( "inspecting file %s" , file) ;
128
- if is_test ( file) { tests += ~[ make_test ( cx, file, configport) ] ; }
128
+ if is_test ( cx. config , file) {
129
+ tests += ~[ make_test ( cx, file, configport) ] ;
130
+ }
129
131
}
130
132
ret { tests : tests, to_task : bind closure_to_task ( cx, configport, _) } ;
131
133
}
132
134
133
- fn is_test ( testfile : & str ) -> bool {
135
+ fn is_test ( config : & config , testfile : & str ) -> bool {
136
+ // Pretty-printer does not work with .rc files yet
137
+ let valid_extensions = alt config. mode {
138
+ mode_pretty. { ~[ ".rs" ] }
139
+ _ { ~[ ".rc" , ".rs" ] }
140
+ } ;
141
+ let invalid_prefixes = ~[ "." , "#" , "~" ] ;
134
142
let name = fs:: basename ( testfile) ;
135
- ( str:: ends_with ( name, ".rs" ) || str:: ends_with ( name, ".rc" ) ) &&
136
- !( str:: starts_with ( name, "." ) || str:: starts_with ( name, "#" ) ||
137
- str:: starts_with ( name, "~" ) )
143
+
144
+ let valid = false ;
145
+
146
+ for ext in valid_extensions {
147
+ if str:: ends_with ( name, ext) { valid = true }
148
+ }
149
+
150
+ for pre in invalid_prefixes {
151
+ if str:: starts_with ( name, pre) { valid = false }
152
+ }
153
+
154
+ ret valid;
138
155
}
139
156
140
157
fn make_test ( cx : & cx , testfile : & str , configport : & port[ str ] ) ->
0 commit comments