diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-11 08:43:06 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-11 08:43:06 +0000 |
commit | d40f7aabd592f45d6ab8c9b4c5e6fd0a31075b3e (patch) | |
tree | 80f7c0c865eeb38453c781d4d2ecbf8505a4d83e /test | |
parent | 448b2a6917390fbda078dba4e36a8ae9b72c1af7 (diff) | |
download | ruby-d40f7aabd592f45d6ab8c9b4c5e6fd0a31075b3e.tar.gz |
compile.c: disable tco with rescue
* compile.c (iseq_optimize): disable tail call optimization in
rescued, rescue, and ensure blocks.
[ruby-core:73871] [Bug #12082]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_optimization.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index 2b414ec5b5..ae5a2d799b 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -295,6 +295,30 @@ class TestRubyOptimization < Test::Unit::TestCase assert_equal(:ok, yield_result) end + def do_raise + raise "should be rescued" + end + + def errinfo + $! + end + + def test_tailcall_inhibited_by_rescue + bug12082 = '[ruby-core:73871] [Bug #12082]' + + tailcall(<<-'end;') + def to_be_rescued + return do_raise + 1 + 2 + rescue + errinfo + end + end; + result = to_be_rescued + assert_instance_of(RuntimeError, result, bug12082) + assert_equal("should be rescued", result.message, bug12082) + end + class Bug10557 def [](_) block_given? |