The test runner's main returns unit, not int. Issue #428
The appropriate way to indicate failure from main is to fail.
This commit is contained in:
@@ -279,7 +279,7 @@ fn mk_main(&test_ctxt cx) -> @ast::item {
|
|||||||
ident = "args",
|
ident = "args",
|
||||||
id = cx.next_node_id());
|
id = cx.next_node_id());
|
||||||
|
|
||||||
auto ret_ty = nospan(ast::ty_int);
|
auto ret_ty = nospan(ast::ty_nil);
|
||||||
|
|
||||||
let ast::fn_decl decl = rec(inputs = ~[args_arg],
|
let ast::fn_decl decl = rec(inputs = ~[args_arg],
|
||||||
output = @ret_ty,
|
output = @ret_ty,
|
||||||
|
|||||||
@@ -27,11 +27,9 @@ type test_desc = rec(test_name name,
|
|||||||
|
|
||||||
// The default console test runner. It accepts the command line
|
// The default console test runner. It accepts the command line
|
||||||
// arguments and a vector of test_descs (generated at compile time).
|
// arguments and a vector of test_descs (generated at compile time).
|
||||||
fn test_main(&vec[str] args, &test_desc[] tests) -> int {
|
fn test_main(&vec[str] args, &test_desc[] tests) {
|
||||||
if (run_tests(parse_opts(args), tests)) {
|
if (!run_tests(parse_opts(args), tests)) {
|
||||||
ret 0;
|
fail "Some tests failed";
|
||||||
} else {
|
|
||||||
ret -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user