summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2024-01-22 13:52:41 -0500
committerAaron Patterson <aaron.patterson@gmail.com>2024-01-22 15:07:52 -0800
commit708fa7740479823e0758623d43afee7b13beba21 (patch)
treec93a5ba2df16554c7757ee3df184d69fbac499aa /test/ruby
parent1838dbf6e7f9335e5ad23d9856bd014d18446f07 (diff)
[PRISM] Fix keyword arguments in IndexOrWriteNode
Fixes ruby/prism#2236.
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_compile_prism.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index fd5787e467..f54097ab66 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -425,6 +425,15 @@ module Prism
hash
CODE
+ # Test with keyword arguments
+ assert_prism_eval(<<~RUBY)
+ h = Object.new
+ def h.[](**b) = 0
+ def h.[]=(*a, **b); end
+
+ h[foo: 1] ||= 2
+ RUBY
+
# Test with keyword splat
assert_prism_eval(<<~RUBY)
h = Object.new