Unverified Commit 769b56c3 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4290 from shuujii/refactor-exception-handling-in-assert

Refactor exception handling in `assert`
parents 76262b8e ad789944
......@@ -47,23 +47,21 @@ def assert(str = 'Assertion failed', iso = '')
$mrbtest_assert_idx = 0
yield
if($mrbtest_assert.size > 0)
$asserts.push(assertion_string('Fail: ', str, iso, nil))
$asserts.push(assertion_string('Fail: ', str, iso))
$ko_test += 1
t_print('F')
else
$ok_test += 1
t_print('.')
end
rescue MRubyTestSkip => e
$asserts.push(assertion_string('Skip: ', str, iso, e))
t_print('?')
rescue Exception => e
bt = e.backtrace if $mrbtest_verbose
if e.class.to_s == 'MRubyTestSkip'
$asserts.push(assertion_string('Skip: ', str, iso, e, nil))
t_print('?')
else
$asserts.push(assertion_string("#{e.class}: ", str, iso, e, bt))
$kill_test += 1
t_print('X')
end
$asserts.push(assertion_string("#{e.class}: ", str, iso, e, bt))
$kill_test += 1
t_print('X')
ensure
$mrbtest_assert = nil
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