1
Fork 0

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",
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],
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
// arguments and a vector of test_descs (generated at compile time).
fn test_main(&vec[str] args, &test_desc[] tests) -> int {
if (run_tests(parse_opts(args), tests)) {
ret 0;
} else {
ret -1;
fn test_main(&vec[str] args, &test_desc[] tests) {
if (!run_tests(parse_opts(args), tests)) {
fail "Some tests failed";
}
}