diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-10 00:32:12 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-10 00:32:12 +0000 |
commit | 4ebe2d4ef05f3c924b5e8e09035a63ada16cda64 (patch) | |
tree | e6edfb06c48b9cf9df1c559f58dc0274bf26544e /test/ruby | |
parent | 8081826be6a1091c311ed4793abffc2ba1194fe0 (diff) | |
download | ruby-4ebe2d4ef05f3c924b5e8e09035a63ada16cda64.tar.gz |
vm_args.c: prefer optarg to keyword splat
* vm_args.c (setup_parameters_complex): prefer optional argument
to splat keyword arguments for backward compatibility.
[ruby-core:82280] [Bug #13791]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_keyword.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index c7dd6c88e3..b673cb7eec 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -506,12 +506,16 @@ class TestKeywordArguments < Test::Unit::TestCase def test_splat_hash m = Object.new def m.f() :ok; end + def m.f2(a = nil) a; end o = {a: 1} assert_raise_with_message(ArgumentError, /unknown keyword: a/) { m.f(**o) } o = {} assert_equal(:ok, m.f(**o), '[ruby-core:68124] [Bug #10856]') + + o = {a: 42} + assert_equal({a: 42}, m.f2(**o), '[ruby-core:82280] [Bug #13791]') end def test_gced_object_in_stack |