diff options
author | tmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-09 10:06:49 +0000 |
---|---|---|
committer | tmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-09 10:06:49 +0000 |
commit | a1119230621d3ab26e93466a6838be42aaa83307 (patch) | |
tree | 3bc13f67b313268a7d7a1e15c108eb40e995e3c3 /test/ruby/test_hash.rb | |
parent | 5dc77048a3854a74113c62f2d942f3a45d9ad9bf (diff) | |
download | ruby-a1119230621d3ab26e93466a6838be42aaa83307.tar.gz |
hash.c: fix segv in Hash#replace
* hash.c (rb_hash_replace): fix segv on `{}.replace({})` introduced
in r44060 [Bug #9230] [ruby-core:58991]
* test/ruby/test_hash.rb: regression test for above
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_hash.rb')
-rw-r--r-- | test/ruby/test_hash.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 0593785148..afb0ca4805 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -592,6 +592,16 @@ class TestHash < Test::Unit::TestCase assert_nil(h[2]) end + def test_replace_bug9230 + h = @cls[] + h.replace(@cls[]) + assert_empty h + + h = @cls[] + h.replace(@cls[].compare_by_identity) + assert_predicate(h, :compare_by_identity?) + end + def test_shift h = @h.dup |