mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
print description on exceptions
This commit is contained in:
+10
-5
@@ -22,17 +22,18 @@ end
|
||||
# iso : The ISO reference code of the feature
|
||||
# which will be tested by this
|
||||
# assertion
|
||||
def assert(str = 'Assertion failed', iso = 'No ISO')
|
||||
def assert(str = 'Assertion failed', iso = '')
|
||||
begin
|
||||
if(!yield)
|
||||
$asserts.push([str, iso])
|
||||
$asserts.push(['Fail: ', str, iso])
|
||||
$ko_test += 1
|
||||
print('F')
|
||||
else
|
||||
$ok_test += 1
|
||||
print('.')
|
||||
end
|
||||
rescue
|
||||
rescue => e
|
||||
$asserts.push(['Error: ', str, iso, e])
|
||||
$kill_test += 1
|
||||
print('X')
|
||||
end
|
||||
@@ -43,9 +44,13 @@ end
|
||||
# which were reported broken.
|
||||
def report()
|
||||
print "\n"
|
||||
$asserts.each do |str, iso|
|
||||
print('Fail: ');
|
||||
$asserts.each do |err, str, iso, e|
|
||||
print(err);
|
||||
print_assertion_string(str, iso)
|
||||
if e
|
||||
print(" => ")
|
||||
print(e.message)
|
||||
end
|
||||
print("\n")
|
||||
end
|
||||
|
||||
|
||||
+2
-2
@@ -23,8 +23,8 @@ assert('Time#initialize_copy', '15.2.19.7.17') do
|
||||
end
|
||||
|
||||
assert('Time#mday', '15.2.19.7.19') do
|
||||
Time.gm(2012, 12, 23).mday == 23
|
||||
end
|
||||
Time.gm(2012, 12, 23).mday == 23
|
||||
end
|
||||
|
||||
assert('Time#month', '15.2.19.7.22') do
|
||||
Time.gm(2012, 12, 23).month == 12
|
||||
|
||||
Reference in New Issue
Block a user