summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortompng <[email protected]>2024-08-06 23:29:45 +0900
committerNobuyoshi Nakada <[email protected]>2024-08-12 18:09:32 +0900
commit992596fb7af18a7f472589a607d0eb3fbb03b49a (patch)
tree609d85d4553880bba35dba01bda5e792a5e9b0b9 /test
parent2a7da0b6e76929c684cd948630a897c1d5b16c26 (diff)
Fix next inside block argument stack underflow
[Bug #20344] Fix compile_next adding removable adjust label
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11316
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_iseq.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb
index 9429d8bc21..67d6606519 100644
--- a/test/ruby/test_iseq.rb
+++ b/test/ruby/test_iseq.rb
@@ -828,6 +828,27 @@ class TestISeq < Test::Unit::TestCase
end;
end
+ def test_unreachable_next_in_block
+ bug20344 = '[ruby-core:117210] [Bug #20344]'
+ assert_nothing_raised(SyntaxError, bug20344) do
+ compile(<<~RUBY)
+ proc do
+ next
+
+ case nil
+ when "a"
+ next
+ when "b"
+ when "c"
+ proc {}
+ end
+
+ next
+ end
+ RUBY
+ end
+ end
+
def test_loading_kwargs_memory_leak
assert_no_memory_leak([], "#{<<~"begin;"}", "#{<<~'end;'}", rss: true)
a = RubyVM::InstructionSequence.compile("foo(bar: :baz)").to_binary