summaryrefslogtreecommitdiff
path: root/test/ruby/test_keyword.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-03 19:08:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-03 19:08:40 +0000
commit140929d8ba0e184a5c84ff6aa9c77ed5832eef68 (patch)
tree8a9557a97ff138622659e7d2c7f3f861d71e169a /test/ruby/test_keyword.rb
parentfc3c52eb37b145ebce2710c2cbf7662fcf0e378f (diff)
vm.c: return the result hash
* vm.c (core_hash_merge_kwd): should return the result hash, which may be converted from and differ from the given argument. [ruby-core:62921] [Bug #9898] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_keyword.rb')
-rw-r--r--test/ruby/test_keyword.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb
index 5988905138..68dd8a91cf 100644
--- a/test/ruby/test_keyword.rb
+++ b/test/ruby/test_keyword.rb
@@ -452,6 +452,17 @@ class TestKeywordArguments < Test::Unit::TestCase
assert_equal({a: 1}, h, bug9776)
end
+ def test_splat_hash_conversion
+ bug9898 = '[ruby-core:62921] [Bug #9898]'
+
+ o = Object.new
+ def o.to_hash() { a: 1 } end
+ assert_equal({a: 1}, m1(**o) {|x| break x}, bug9898)
+ o2 = Object.new
+ def o2.to_hash() { b: 2 } end
+ assert_equal({a: 1, b: 2}, m1(**o, **o2) {|x| break x}, bug9898)
+ end
+
def test_gced_object_in_stack
bug8964 = '[ruby-dev:47729] [Bug #8964]'
assert_normal_exit %q{