From 07b9b53459d1842e7066b248d48ef4952c6868d3 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 16 Jan 2024 10:30:31 -0500 Subject: [PRISM] Fix crash with empty ensure blocks Fixes ruby/prism#2179. --- test/ruby/test_compile_prism.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index cd521e6766..bc9f0b3aba 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -962,6 +962,22 @@ module Prism end prism_test_ensure_node CODE + + # Test empty ensure block + assert_prism_eval(<<~RUBY) + res = [] + + begin + begin + raise + ensure + end + rescue + res << "rescue" + end + + res + RUBY end def test_NextNode -- cgit v1.2.3