From 81dc383291fa5c31e0b07983ae5ba8a2906e0719 Mon Sep 17 00:00:00 2001 From: bamchoh Date: Sat, 9 Dec 2017 02:12:37 +0900 Subject: Use same format between Fail and Skip We can see gem name in skip message by this fix --- test/assert.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test/assert.rb') diff --git a/test/assert.rb b/test/assert.rb index fb7ae9ab8..a9baae5e1 100644 --- a/test/assert.rb +++ b/test/assert.rb @@ -20,7 +20,8 @@ end def assertion_string(err, str, iso=nil, e=nil, bt=nil) msg = "#{err}#{str}" msg += " [#{iso}]" if iso && iso != '' - msg += " => #{e.message}" if e + msg += " => #{e.cause}" if e && e.respond_to?(:cause) + msg += " => #{e.message}" if e && !e.respond_to?(:cause) msg += " (mrbgems: #{GEMNAME})" if Object.const_defined?(:GEMNAME) if $mrbtest_assert && $mrbtest_assert.size > 0 $mrbtest_assert.each do |idx, assert_msg, diff| @@ -56,7 +57,7 @@ def assert(str = 'Assertion failed', iso = '') rescue Exception => e bt = e.backtrace if $mrbtest_verbose if e.class.to_s == 'MRubyTestSkip' - $asserts.push "Skip: #{str} #{iso} #{e.cause}" + $asserts.push(assertion_string('Skip: ', str, iso, e, nil)) t_print('?') else $asserts.push(assertion_string("#{e.class}: ", str, iso, e, bt)) -- cgit v1.2.3