diff options
| author | Aaron Patterson <tenderlove@ruby-lang.org> | 2024-01-22 14:51:12 -0800 |
|---|---|---|
| committer | Aaron Patterson <aaron.patterson@gmail.com> | 2024-01-22 16:02:41 -0800 |
| commit | 270a46e392dab13e422b2b9f27f2893a3fecd77b (patch) | |
| tree | 0dc47648b3093eb6e57b1991fff75fe8a426241b /test/ruby | |
| parent | ee7f63ebba542f87e6fa28709e67ace0fefcae90 (diff) | |
Check keyword parameters correctly
We weren't checking the right offsets when compiling methods with
keyword parameters that had complex code.
Fixes: https://github.com/ruby/prism/issues/2228
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index f54097ab66..328074fc52 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -1515,6 +1515,11 @@ a CODE 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)") + end + def test_rescue_with_ensure assert_prism_eval(<<-CODE) begin |
