diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-27 02:53:45 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-27 02:53:45 +0000 |
| commit | 48f05e0bff313ee223b893bba232ec075104495d (patch) | |
| tree | 5dc8d28386555348222a41e3219641b3edf60178 /test | |
| parent | 571e78d2080c63f31f6325120497c2d1dc4b7450 (diff) | |
merges r22308 from trunk into ruby_1_9_1.
--
* 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@25938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
| -rw-r--r-- | test/ruby/test_hash.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 3f5944384..7060287d5 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -851,4 +851,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 |
