diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-18 03:38:52 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-01-18 03:38:52 +0000 |
commit | b97ee6c636053d334860cd7d4833cd9531552c37 (patch) | |
tree | adbaf37e68a52d46be17cf5f1d2c28feabb58ce6 /test/ruby/test_keyword.rb | |
parent | 6f29e0ee09a26df04352106962d612a9b4335dbb (diff) | |
download | ruby-b97ee6c636053d334860cd7d4833cd9531552c37.tar.gz |
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/trunk@57360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_keyword.rb')
-rw-r--r-- | test/ruby/test_keyword.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index ad0bf63492..f10412e6cd 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -629,4 +629,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 |