diff options
| author | Aaron Patterson <tenderlove@ruby-lang.org> | 2024-01-22 16:03:58 -0800 |
|---|---|---|
| committer | Aaron Patterson <aaron.patterson@gmail.com> | 2024-01-22 16:35:58 -0800 |
| commit | cfa15bb173723b8bb6110a81241bcdffa18193fb (patch) | |
| tree | d4519c280dac89df625ed6cc42c5492cf3c7f80d /test/ruby | |
| parent | 6fb9dc5089e970ab977c76e9c13562e516b677ec (diff) | |
Handle trailing commas on blocks
We need to set a special flag on block iseqs when there is a trailing
comma.
Fixes: https://github.com/ruby/prism/issues/2244
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index 328074fc52..10def69ff2 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -1515,6 +1515,10 @@ a CODE end + def test_trailing_comma_on_block + assert_prism_eval("def self.m; yield [:ok]; end; m {|v0,| v0 }") + end + def test_complex_default_params assert_prism_eval("def self.foo(a:, b: '2'.to_i); [a, b]; end; foo(a: 1)") assert_prism_eval("def self.foo(a:, b: 2, c: '3'.to_i); [a, b, c]; end; foo(a: 1)") |
