summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2025-02-13 17:52:03 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2025-02-13 17:52:03 -0800
commit68013d43a35a8368caa7b30c501e270333d04b35 (patch)
treea45d163b5c911390cda0723f2daa41455a3e4ce3 /test/ruby
parent8a86e52fb5fc49367e79f8f49fb451ab74e089bb (diff)
merge revision(s) 31905d9e23ec6d1fa2a52f1ef2533f2056e7c9fb: [Backport #21001]
Allow escaping from ensures through next Fixes [Bug #21001]
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_compile_prism.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index 043d5d8c0e..33a8b17b99 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -1189,6 +1189,27 @@ a
res
RUBY
+
+ # Bug #21001
+ assert_prism_eval(<<~RUBY)
+ RUN_ARRAY = [1,2]
+
+ MAP_PROC = Proc.new do |&blk|
+ block_results = []
+ RUN_ARRAY.each do |value|
+ block_value = blk.call(value)
+ block_results.push block_value
+ end
+ block_results
+ ensure
+ next block_results
+ end
+
+ MAP_PROC.call do |value|
+ break if value > 1
+ next value
+ end
+ RUBY
end
def test_NextNode