summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-04 14:30:28 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-04 14:30:28 +0000
commit2392c12bd183241e8d255aa882f53ebd845b7dd8 (patch)
treeffbae09c1170acbed50ed39900ba20048b3283c6 /test
parente377d3bb755f5126dce2e655e3469a13e1ed885c (diff)
merge revision(s) 40992: [Backport #8040]
* vm_insnhelper.c (vm_callee_setup_keyword_arg, vm_callee_setup_arg_complex): consider a hash argument for keyword only when the number of arguments is more than the expected mandatory parameters. [ruby-core:53199] [ruby-trunk - Bug #8040] * test/ruby/test_keyword.rb: update a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@41063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_keyword.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb
index 5f53483918..05b3e06de1 100644
--- a/test/ruby/test_keyword.rb
+++ b/test/ruby/test_keyword.rb
@@ -22,7 +22,6 @@ class TestKeywordArguments < Test::Unit::TestCase
def test_f2
assert_equal([:xyz, "foo", 424242], f2(:xyz))
- assert_raise(ArgumentError) { f2({}) } # [ruby-dev:46712] [Bug #7529]
assert_equal([{"bar"=>42}, "foo", 424242], f2("bar"=>42))
end
@@ -342,4 +341,15 @@ class TestKeywordArguments < Test::Unit::TestCase
end
assert_equal({:bar=>"x"}, a.new.foo(bar: "x"), bug8416)
end
+
+ def test_precedence_of_keyword_arguments
+ bug8040 = '[ruby-core:53199] [Bug #8040]'
+ a = Class.new do
+ def foo(x, **h)
+ [x, h]
+ end
+ end
+ assert_equal([{}, {}], a.new.foo({}))
+ assert_equal([{}, {:bar=>"x"}], a.new.foo({}, bar: "x"))
+ end
end