Merge pull request #833 from iij/pr-mrbtest-verbose

add mrbtest verbose mode ('-v' option)
This commit is contained in:
Yukihiro "Matz" Matsumoto
2013-02-09 04:42:32 -08:00
2 changed files with 8 additions and 1 deletions
+2
View File
@@ -23,6 +23,7 @@ end
# which will be tested by this
# assertion
def assert(str = 'Assertion failed', iso = '')
print(str, (iso != '' ? " [#{iso}]" : ''), ' : ') if $mrbtest_verbose
begin
if(!yield)
$asserts.push(assertion_string('Fail: ', str, iso))
@@ -37,6 +38,7 @@ def assert(str = 'Assertion failed', iso = '')
$kill_test += 1
print('X')
end
print("\n") if $mrbtest_verbose
end
##
+6 -1
View File
@@ -36,7 +36,7 @@ check_error(mrb_state *mrb)
}
int
main(void)
main(int argc, char **argv)
{
mrb_state *mrb;
mrb_value return_value;
@@ -52,6 +52,11 @@ main(void)
return EXIT_FAILURE;
}
if (argc == 2 && strncmp(argv[1], "-v", 2) == 0) {
printf("verbose mode: enable\n\n");
mrb_gv_set(mrb, mrb_intern(mrb, "$mrbtest_verbose"), mrb_true_value());
}
mrb_init_mrbtest(mrb);
/* evaluate the test */
return_value = mrb_load_string(mrb, prog);