From a383ffa07b4641f6e19500e95cf9388af05e510c Mon Sep 17 00:00:00 2001 From: usa Date: Mon, 7 Jul 2014 03:58:01 +0000 Subject: merge revision(s) 45642,45643: [Backport #9646] [Backport #9729] * st.c (st_foreach_check): chnage start point of search at check from top to current. [ruby-dev:48047] [Bug #9646] * st.c (st_foreach_check): change start point of search at check git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_hash.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index b545395780..cc7555fc5e 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -951,6 +951,17 @@ class TestHash < Test::Unit::TestCase assert_predicate(h.dup, :compare_by_identity?, bug8703) end + def test_same_key + bug9646 = '[ruby-dev:48047] [Bug #9646] Infinite loop at Hash#each' + h = @cls[a=[], 1] + a << 1 + h[[]] = 2 + a.clear + cnt = 0 + r = h.each{ break nil if (cnt+=1) > 100 } + assert_not_nil(r,bug9646) + end + class ObjWithHash def initialize(value, hash) @value = value -- cgit v1.2.3