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:
Brian Anderson
2011-07-14 10:51:38 -07:00
parent f4beac4a43
commit 4038010bc6
2 changed files with 4 additions and 6 deletions

View File

@@ -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,

View File

@@ -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;
} }
} }