Unverified Commit 63124bf6 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4327 from shuujii/do-not-raise-an-exception-when-bintest-fail

Do not raise an exception when bintest fail
parents ad0a8888 c3122c88
......@@ -29,32 +29,20 @@ print_hint(void)
printf("mrbtest - Embeddable Ruby Test\n\n");
}
static int
check_error(mrb_state *mrb)
{
/* Error check */
/* $ko_test and $kill_test should be 0 */
mrb_value ko_test = mrb_gv_get(mrb, mrb_intern_lit(mrb, "$ko_test"));
mrb_value kill_test = mrb_gv_get(mrb, mrb_intern_lit(mrb, "$kill_test"));
return mrb_fixnum_p(ko_test) && mrb_fixnum(ko_test) == 0 && mrb_fixnum_p(kill_test) && mrb_fixnum(kill_test) == 0;
}
static int
eval_test(mrb_state *mrb)
{
/* evaluate the test */
mrb_funcall(mrb, mrb_top_self(mrb), "report", 0);
mrb_value result = mrb_funcall(mrb, mrb_top_self(mrb), "report", 0);
/* did an exception occur? */
if (mrb->exc) {
mrb_print_error(mrb);
mrb->exc = 0;
return EXIT_FAILURE;
}
else if (!check_error(mrb)) {
return EXIT_FAILURE;
else {
return mrb_bool(result) ? EXIT_SUCCESS : EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
static void
......
......@@ -213,7 +213,7 @@ end
##
# Report the test result and print all assertions
# which were reported broken.
def report()
def report
t_print("\n")
$asserts.each do |msg|
......@@ -232,6 +232,8 @@ def report()
t_time = Time.now - $test_start
t_print(" Time: #{t_time.round(2)} seconds\n")
end
$ko_test == 0 && $kill_test == 0
end
##
......
......@@ -39,4 +39,4 @@ ARGV.each do |gem|
end
end
load 'test/report.rb'
exit report
report
if $ko_test > 0 or $kill_test > 0
raise "mrbtest failed (KO:#{$ko_test}, Crash:#{$kill_test})"
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment