summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAaron Patterson <[email protected]>2024-01-19 12:00:35 -0800
committerAaron Patterson <[email protected]>2024-01-19 12:32:20 -0800
commit4778b0eedaf4b490fe6b1fe2df9b58c1fe8e7639 (patch)
treeb2999b269705a52edbb20f6bd2f75fed0cbf7671 /test
parente0f7cee8c54691127277d32b4560e44b8394cdc7 (diff)
Fix kwarg ordering
Required keyword arguments need to come first. Fixes: https://github.com/ruby/prism/issues/2158 Co-authored-by: Kevin Newton <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_compile_prism.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb
index e1bd5cfb69..b675e23351 100644
--- a/test/ruby/test_compile_prism.rb
+++ b/test/ruby/test_compile_prism.rb
@@ -1464,6 +1464,10 @@ a
CODE
end
+ def test_required_kwarg_ordering
+ assert_prism_eval("def self.foo(a: 1, b:); [a, b]; end; foo(b: 2)")
+ end
+
def test_trailing_keyword_method_params
# foo(1, b: 2, c: 3) # argc -> 3
assert_prism_eval("def self.foo(a, b:, c:); [a, b, c]; end; foo(1, b: 2, c: 3)")