Skip to content

Commit 25b0daf

Browse files
committed
---
yaml --- r: 4329 b: refs/heads/master c: 39d3b93 h: refs/heads/master i: 4327: 9761690 v: v3
1 parent e2e4f5c commit 25b0daf

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 4e8ab8b3a8fa324754023feeb4406482c4643feb
2+
refs/heads/master: 39d3b93a38e613e013d6087cde8343607ac7317d

trunk/src/test/compiletest/compiletest.rs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,33 @@ fn make_tests(cx: &cx) -> tests_and_conv_fn {
125125
let tests = ~[];
126126
for file: str in fs::list_dir(cx.config.src_base) {
127127
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+
}
129131
}
130132
ret {tests: tests, to_task: bind closure_to_task(cx, configport, _)};
131133
}
132134

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 = ~[".", "#", "~"];
134142
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;
138155
}
139156

140157
fn make_test(cx: &cx, testfile: &str, configport: &port[str]) ->

0 commit comments

Comments
 (0)