From ba81af97e957d7551f76817c5c270f2b3cbc7e6d Mon Sep 17 00:00:00 2001 From: nagachika Date: Mon, 27 Mar 2017 16:05:01 +0000 Subject: merge revision(s) 57360: [Backport #12884] class.c: non-keyword hash class * class.c (rb_extract_keywords): keep the class of non-keyword elements hash as the original. [ruby-core:77813] [Bug #12884] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_keyword.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index ef9e71e0b2..5aced32d90 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -624,4 +624,16 @@ class TestKeywordArguments < Test::Unit::TestCase klass.new(d: 4) end end + + def test_non_keyword_hash_subclass + bug12884 = '[ruby-core:77813] [Bug #12884]' + klass = EnvUtil.labeled_class("Child", Hash) + obj = Object.new + def obj.t(params = klass.new, d: nil); params; end + x = klass.new + x["foo"] = "bar" + result = obj.t(x) + assert_equal(x, result) + assert_kind_of(klass, result, bug12884) + end end -- cgit v1.2.3