diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2024-01-22 11:43:00 -0500 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2024-01-22 12:56:43 -0500 |
| commit | dbd76d9101cfb35b483ad5e173fc153102c9d03e (patch) | |
| tree | 4f4a866030048f1d4aa7ad3969864b5bb7e6892e /test/ruby | |
| parent | ab99ce910ce9a7aeb0b8a3224a1ed1e3e5faf71f (diff) | |
[PRISM] Fix keyword splat in IndexAndWriteNode and IndexOrWriteNode
Fixes ruby/prism#2232 and ruby/prism#2234.
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 0998c8fa5d..8f42fb5851 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -394,6 +394,15 @@ module Prism h[foo: 1] &&= 2 RUBY + + # Test with keyword splat + assert_prism_eval(<<~RUBY) + h = Object.new + def h.[](**b) = 1 + def h.[]=(*a, **b); end + + h[**{}] &&= 2 + RUBY end def test_IndexOrWriteNode @@ -415,6 +424,15 @@ module Prism hash["key", &(Proc.new { _1.upcase })] ||= "value" hash CODE + + # Test with keyword splat + assert_prism_eval(<<~RUBY) + h = Object.new + def h.[](**b) = nil + def h.[]=(*a, **b); end + + h[**{}] ||= 2 + RUBY end def test_IndexOperatorWriteNode |
