mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* compile.c (iseq_set_arguments): keyword rest arg without keyword args.
* node.c (dump_node): dump kw_rest_arg too. * parse.y (block_param, f_arg): more kwrest patterns. [ruby-core:42455][Bug #5989] * parse.y (new_args_gen): no extra kw_rest_arg if no keyword rest arg. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d6a977f667
commit
8fe3fb4c0f
6 changed files with 241 additions and 708 deletions
|
@ -79,8 +79,13 @@ class TestSyntax < Test::Unit::TestCase
|
|||
|
||||
def test_keyword_rest
|
||||
bug5989 = '[ruby-core:42455]'
|
||||
assert_valid_syntax("def kwrest_test(**a) end", __FILE__)
|
||||
assert_valid_syntax("def kwrest_test(**a, &b) end", __FILE__)
|
||||
assert_valid_syntax("def kwrest_test(**a) a; end", __FILE__)
|
||||
assert_valid_syntax("def kwrest_test2(**a, &b) end", __FILE__)
|
||||
o = Object.new
|
||||
def o.kw(**a) a end
|
||||
assert_equal({}, o.kw)
|
||||
assert_equal({foo: 1}, o.kw(foo: 1))
|
||||
assert_equal({foo: 1, bar: 2}, o.kw(foo: 1, bar: 2))
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue