diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-05-21 10:39:29 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-05-21 10:39:29 +0900 |
| commit | 21bd5d792418910978266563a46974412bba8e0b (patch) | |
| tree | ff652219d56004f3af62a4c457f69df6323bd915 /test/assert.rb | |
| parent | 84a2fb102c20ddf51db9e29e6e8c3bb1c263a94b (diff) | |
| download | mruby-21bd5d792418910978266563a46974412bba8e0b.tar.gz mruby-21bd5d792418910978266563a46974412bba8e0b.zip | |
print description on exceptions
Diffstat (limited to 'test/assert.rb')
| -rw-r--r-- | test/assert.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/assert.rb b/test/assert.rb index a4918ce23..239730cb9 100644 --- a/test/assert.rb +++ b/test/assert.rb @@ -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 |
