From ddd62fadaf91418cd259593285bc59358fb0b166 Mon Sep 17 00:00:00 2001 From: Shugo Maeda Date: Wed, 16 Nov 2022 23:03:39 +0900 Subject: Allow anonymous keyword rest parameter with other keyword parameters Fixes [Bug #19132] --- test/ruby/test_ast.rb | 2 +- test/ruby/test_syntax.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'test/ruby') diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb index 0932e93d5a..7af6e43e1d 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -469,7 +469,7 @@ class TestAst < Test::Unit::TestCase end assert_equal(nil, kwrest.call('')) - assert_equal([nil], kwrest.call('**')) + assert_equal([:**], kwrest.call('**')) assert_equal(false, kwrest.call('**nil')) assert_equal([:a], kwrest.call('**a')) end diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index b0ad012131..7a5f4c9528 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -163,9 +163,11 @@ class TestSyntax < Test::Unit::TestCase def c(**kw); kw end def d(**); b(k: 1, **) end def e(**); b(**, k: 1) end + def f(a: nil, **); b(**) end assert_equal({a: 1, k: 3}, b(a: 1, k: 3)) assert_equal({a: 1, k: 3}, d(a: 1, k: 3)) assert_equal({a: 1, k: 1}, e(a: 1, k: 3)) + assert_equal({k: 3}, f(a: 1, k: 3)) end; end -- cgit v1.2.3