Skip to content

Commit 4038010

Browse files
committed
The test runner's main returns unit, not int. Issue #428
The appropriate way to indicate failure from main is to fail.
1 parent f4beac4 commit 4038010

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/comp/front/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ fn mk_main(&test_ctxt cx) -> @ast::item {
279279
ident = "args",
280280
id = cx.next_node_id());
281281

282-
auto ret_ty = nospan(ast::ty_int);
282+
auto ret_ty = nospan(ast::ty_nil);
283283

284284
let ast::fn_decl decl = rec(inputs = ~[args_arg],
285285
output = @ret_ty,

src/lib/test.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ type test_desc = rec(test_name name,
2727

2828
// The default console test runner. It accepts the command line
2929
// arguments and a vector of test_descs (generated at compile time).
30-
fn test_main(&vec[str] args, &test_desc[] tests) -> int {
31-
if (run_tests(parse_opts(args), tests)) {
32-
ret 0;
33-
} else {
34-
ret -1;
30+
fn test_main(&vec[str] args, &test_desc[] tests) {
31+
if (!run_tests(parse_opts(args), tests)) {
32+
fail "Some tests failed";
3533
}
3634
}
3735

0 commit comments

Comments
 (0)