aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorMatt Valentine-House <matt@eightbitraptor.com>2023-12-01 14:37:10 +0000
committerKevin Newton <kddnewton@gmail.com>2023-12-06 07:02:04 -0500
commitd6ec1aa0a79235e75cbb92141590199a322e7bf1 (patch)
tree2d878cdff96647f985bb6406bec170cc62d9cf10 /test/ruby
parent34543f7c75c28f8b650b5ef3c30eb2c5314c4db5 (diff)
downloadruby-d6ec1aa0a79235e75cbb92141590199a322e7bf1.tar.gz
[PRISM] Compile Rescue Modifier nodes
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