diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-08 06:19:06 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-08 06:19:06 +0000 |
commit | 05f891cbbb4ee3b09e83e50924d96bddb8f67b91 (patch) | |
tree | bc22c6c7a49bc246fc77c9d8eb163fb246908103 /test | |
parent | 7bbab207cbe0c92777fcb30e21cde787ca9a3863 (diff) |
vm.c: check type of hash to merge
* vm.c (core_hash_merge): check the type of the target hash to
merge. [ruby-core:78536] [Bug #13015]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_keyword.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index bcb93a6348..ad0bf63492 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -609,4 +609,24 @@ class TestKeywordArguments < Test::Unit::TestCase assert_equal({x: 1, y: 2, **h}, obj.foo) } end + + def test_kwrest_overwritten + bug13015 = '[ruby-core:78536] [Bug #13015]' + + klass = EnvUtil.labeled_class("Parent") do + def initialize(d:) + end + end + + klass = EnvUtil.labeled_class("Child", klass) do + def initialize(d:, **h) + h = [2, 3] + super + end + end + + assert_raise_with_message(TypeError, /expected Hash/, bug13015) do + klass.new(d: 4) + end + end end |