aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_compile_prism.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index 905e29b0d2..fb377813fb 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -914,6 +914,14 @@ module Prism
assert_prism_eval("begin; rescue; end")
end
+ def test_RescueModiferNode
+ assert_prism_eval("1.nil? rescue false")
+ assert_prism_eval("1.nil? rescue 1")
+ assert_prism_eval("raise 'bang' rescue nil")
+ assert_prism_eval("raise 'bang' rescue a = 1; a.nil?")
+ assert_prism_eval("a = 0 rescue (a += 1 && retry if a <= 1)")
+ end
+
def test_RetryNode
assert_prism_eval(<<~CODE)
a = 1
@@ -945,7 +953,6 @@ module Prism
CODE
end
-
def test_ReturnNode
assert_prism_eval("def return_node; return 1; end")
end