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 | f0226f0a3c836e9262c5cd2671860140878d6b75 (patch) | |
tree | 80f7c0c865eeb38453c781d4d2ecbf8505a4d83e /test/ruby | |
parent | 0ebf3849e4dee70b65dec91997400a235411dc15 (diff) | |
download | ruby-f0226f0a3c836e9262c5cd2671860140878d6b75.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/ruby')
-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? |