Skip to content

Commit e4d6c27

Browse files
committed
---
yaml --- r: 4716 b: refs/heads/master c: 184eac9 h: refs/heads/master v: v3
1 parent d9c95f5 commit e4d6c27

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
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: 053b8bff5a81a0cb6c347f8c371fa5b66f48dbda
2+
refs/heads/master: 184eac90ab5e5e1e52d24b6711813bf3b66c1fea

trunk/src/comp/front/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ We're going to be building a module that looks more or less like:
135135
136136
mod __test {
137137
138-
fn main(vec[str] args) -> int {
138+
fn main(args: [str]) -> int {
139139
std::test::test_main(args, tests())
140140
}
141141
@@ -285,7 +285,7 @@ fn mk_test_desc_rec(cx: &test_ctxt, test: test) -> @ast::expr {
285285
fn mk_main(cx: &test_ctxt) -> @ast::item {
286286

287287
let args_mt: ast::mt = {ty: @nospan(ast::ty_str), mut: ast::imm};
288-
let args_ty: ast::ty = nospan(ast::ty_vec(args_mt));
288+
let args_ty: ast::ty = nospan(ast::ty_ivec(args_mt));
289289

290290
let args_arg: ast::arg =
291291
{mode: ast::val, ty: @args_ty, ident: "args", id: cx.next_node_id()};
@@ -355,7 +355,7 @@ fn mk_test_main_call(cx: &test_ctxt) -> @ast::expr {
355355
// Call std::test::test_main
356356
let test_main_path: ast::path =
357357
nospan({global: false,
358-
idents: ~["std", "test", "test_main"],
358+
idents: ~["std", "test", "test_main_ivec"],
359359
types: ~[]});
360360

361361
let test_main_path_expr_: ast::expr_ = ast::expr_path(test_main_path);

trunk/src/lib/test.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export test_name;
1010
export test_fn;
1111
export test_desc;
1212
export test_main;
13+
export test_main_ivec;
1314
export test_result;
1415
export test_opts;
1516
export tr_ok;
@@ -48,18 +49,20 @@ type test_desc = {name: test_name, fn: test_fn, ignore: bool};
4849

4950
// The default console test runner. It accepts the command line
5051
// arguments and a vector of test_descs (generated at compile time).
51-
fn test_main(args: &vec[str], tests: &[test_desc]) {
52-
let ivec_args =
53-
{ let iargs = ~[]; for arg: str in args { iargs += ~[arg] } iargs };
54-
check (ivec::is_not_empty(ivec_args));
52+
fn test_main_ivec(args: &[str], tests: &[test_desc]) {
53+
check (ivec::is_not_empty(args));
5554
let opts =
56-
alt parse_opts(ivec_args) {
55+
alt parse_opts(args) {
5756
either::left(o) { o }
5857
either::right(m) { fail m }
5958
};
6059
if !run_tests_console(opts, tests) { fail "Some tests failed"; }
6160
}
6261

62+
fn test_main(args: &vec[str], tests: &[test_desc]) {
63+
test_main_ivec(ivec::from_vec(args), tests);
64+
}
65+
6366
type test_opts = {filter: option::t[str], run_ignored: bool};
6467

6568
type opt_res = either::t[test_opts, str];

0 commit comments

Comments
 (0)