summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-30 10:50:41 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-30 10:50:41 +0000
commit6f9f8d2ef7d9c19e39194e6914e4cf39eaa5d473 (patch)
tree08d2c0458a56d611569f611a2b89257db0d9fd3e /test
parent89a452c7c1883607f16ae20e940ec537b69a67df (diff)
* 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/trunk@40992 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 7443937942..ed1f79cfd3 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
@@ -379,4 +378,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