aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_exception.rb
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2021-05-18 17:11:39 +0900
committerKoichi Sasada <ko1@atdot.net>2021-05-21 18:12:14 +0900
commit817764bd82513e2a0a672f5958f65854ea172c08 (patch)
tree005bfd5847e2e62c10ba823a7f1ec8b37acd1fa7 /test/ruby/test_exception.rb
parent59b327aa58d3f514030b0afb767f11ab6ca0a76d (diff)
downloadruby-817764bd82513e2a0a672f5958f65854ea172c08.tar.gz
simple rescue+while+break should not use `throw`
609de71f043e8ba34f22b9993e444e2e5bb05709 fixes the issue by using `throw` insn if `ensure` is used. However, that patch introduce additional `throw` even if it is not needed. This patch solves the issue. This issue is pointed by @mame.
Diffstat (limited to 'test/ruby/test_exception.rb')
-rw-r--r--test/ruby/test_exception.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index af29163ce3..8c4e6889ab 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -104,6 +104,17 @@ class TestException < Test::Unit::TestCase
end
end
end
+
+ iseq = RubyVM::InstructionSequence.compile(<<-RUBY)
+ begin
+ while true
+ break
+ end
+ rescue
+ end
+ RUBY
+
+ assert_equal false, iseq.to_a[13].any?{|(e,_)| e == :throw}
end
def test_exception_in_ensure_with_redo