diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-07-14 10:51:38 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-07-14 10:51:38 -0700 |
| commit | 4038010bc658c75b8f6efa99790e611c29e84763 (patch) | |
| tree | e058b3699b9356846bd566935c45b5257858e03c | |
| parent | f4beac4a4337296ab356d69ad1ed42f68f461bf1 (diff) | |
The test runner's main returns unit, not int. Issue #428
The appropriate way to indicate failure from main is to fail.
| -rw-r--r-- | src/comp/front/test.rs | 2 | ||||
| -rw-r--r-- | src/lib/test.rs | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/comp/front/test.rs b/src/comp/front/test.rs index 1bae202b4b1..939d2c717da 100644 --- a/src/comp/front/test.rs +++ b/src/comp/front/test.rs @@ -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, diff --git a/src/lib/test.rs b/src/lib/test.rs index 5aa1bc16b4a..ebf82b14d03 100644 --- a/src/lib/test.rs +++ b/src/lib/test.rs @@ -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"; } } |
