summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/assert.rb24
-rw-r--r--test/t/exception.rb10
2 files changed, 26 insertions, 8 deletions
diff --git a/test/assert.rb b/test/assert.rb
index 027d2a66f..269c435a7 100644
--- a/test/assert.rb
+++ b/test/assert.rb
@@ -41,9 +41,14 @@ def assert(str = 'Assertion failed', iso = '')
print('.')
end
rescue Exception => e
- $asserts.push(assertion_string('Error: ', str, iso, e))
- $kill_test += 1
- print('X')
+ if e.class.to_s == 'MRubyTestSkip'
+ $asserts.push "Skip: #{str} #{iso} #{e.cause}"
+ print('?')
+ else
+ $asserts.push(assertion_string('Error: ', str, iso, e))
+ $kill_test += 1
+ print('X')
+ end
ensure
$mrbtest_assert = nil
end
@@ -157,3 +162,16 @@ def check_float(a, b)
true
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
diff --git a/test/t/exception.rb b/test/t/exception.rb
index 663c8f337..7ecc51fa8 100644
--- a/test/t/exception.rb
+++ b/test/t/exception.rb
@@ -321,19 +321,19 @@ end
# very deeply recursive function that stil returns albeit very deeply so
$test_infinite_recursion = 0
-TEST_INFINITE_RECURSION_MAX = 100000
+TEST_INFINITE_RECURSION_MAX = 1000000
def test_infinite_recursion
$test_infinite_recursion += 1
if $test_infinite_recursion > TEST_INFINITE_RECURSION_MAX
- return $test_infinite_recursion
+ return $test_infinite_recursion
end
- test_infinite_recursion
+ test_infinite_recursion
end
assert('Infinite recursion should result in an exception being raised') do
- a = begin
+ a = begin
test_infinite_recursion
- rescue
+ rescue
:ok
end
# OK if an exception was caught, otherwise a number will be stored in a