diff options
| author | Daniel Bovensiepen <[email protected]> | 2012-12-06 08:53:32 +0800 |
|---|---|---|
| committer | Daniel Bovensiepen <[email protected]> | 2012-12-06 08:53:32 +0800 |
| commit | 466ed80b60fcbdf513c4d397c661e71626b9bd30 (patch) | |
| tree | 21a123c69d3a27e100a8c3a7654fc4609504b11e /test | |
| parent | be99d87ca49da86f1795bd1779f9ce82cf821a6e (diff) | |
| parent | 40daee12cfbf6dac4421f47c9c953788985fe238 (diff) | |
| download | mruby-466ed80b60fcbdf513c4d397c661e71626b9bd30.tar.gz mruby-466ed80b60fcbdf513c4d397c661e71626b9bd30.zip | |
Merge remote-tracking branch 'mruby/master' into mrbgems
Diffstat (limited to 'test')
| -rw-r--r-- | test/t/exception.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/t/exception.rb b/test/t/exception.rb index aa707c1b1..a2e6acc07 100644 --- a/test/t/exception.rb +++ b/test/t/exception.rb @@ -290,3 +290,26 @@ end assert('Exception#inspect without message') do Exception.new.inspect end + +# very deeply recursive function that stil returns albeit very deeply so +$test_infinite_recursion = 0 +TEST_INFINITE_RECURSION_MAX = 100000 +def test_infinite_recursion + $test_infinite_recursion += 1 + if $test_infinite_recursion > TEST_INFINITE_RECURSION_MAX + return $test_infinite_recursion + end + test_infinite_recursion +end + +assert('Infinite recursion should result in an exception being raised') do + a = begin + test_infinite_recursion + rescue + :ok + end + # OK if an exception was caught, otherwise a number will be stored in a + a == :ok +end + + |
