From 5164ba53f2b17ead1e0c471652012ed4557b4b8d Mon Sep 17 00:00:00 2001 From: shyouhei Date: Sun, 13 Dec 2009 17:48:12 +0000 Subject: merge revision(s) 25659:25661: * hash.c (rb_hash): always return a fixnum value because a return value of rb_hash may be used as a hash value itself and bignums have no unique VALUE. * test/ruby/test_hash.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@26081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_hash.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 4131a6bdd3..71cf8dab93 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -638,4 +638,15 @@ class TestHash < Test::Unit::TestCase def test_hash_hash assert_equal({0=>2,11=>1}.hash, {11=>1,0=>2}.hash) end + + def test_hash_bignum_hash + x = 2<<(32-3)-1 + assert_equal({x=>1}.hash, {x=>1}.hash) + x = 2<<(64-3)-1 + assert_equal({x=>1}.hash, {x=>1}.hash) + + o = Object.new + def o.hash; 2<<100; end + assert_equal({x=>1}.hash, {x=>1}.hash) + end end -- cgit v1.2.3