summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-13 13:00:17 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-03-13 13:00:17 +0000
commit8fe3fb4c0f69535b302e124f3afc58dce4be5dbb (patch)
treee9f4735377f581a28a4d472f8c16a96d191b6a38 /test/ruby
parentd6a977f667f9d824cfe95976f3afc31e55580edb (diff)
* 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
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_syntax.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 532b989bbd..5ede83caba 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -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