Commit a3135e80 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #885 from mattn/test_skip

Add skip method for test
parents 8a902642 68195055
...@@ -41,9 +41,14 @@ def assert(str = 'Assertion failed', iso = '') ...@@ -41,9 +41,14 @@ def assert(str = 'Assertion failed', iso = '')
print('.') print('.')
end end
rescue Exception => e rescue Exception => e
$asserts.push(assertion_string('Error: ', str, iso, e)) if e.class.to_s == 'MRubyTestSkip'
$kill_test += 1 $asserts.push "Skip: #{str} #{iso} #{e.cause}"
print('X') print('?')
else
$asserts.push(assertion_string('Error: ', str, iso, e))
$kill_test += 1
print('X')
end
ensure ensure
$mrbtest_assert = nil $mrbtest_assert = nil
end end
...@@ -157,3 +162,16 @@ def check_float(a, b) ...@@ -157,3 +162,16 @@ def check_float(a, b)
true true
end end
end end
##
# Skip the test
class MRubyTestSkip < NotImplementedError
attr_accessor :cause
def initialize(cause)
@cause = cause
end
end
def skip(cause = "")
raise MRubyTestSkip.new(cause)
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