summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-05 12:22:24 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-05 12:22:24 +0000
commitee3e66e7a61c2deba096756aadc390c82fd2d17b (patch)
tree462f4ce61b5c2a6ee594ff09894f09e5a3f26100 /test
parent60a40ecaf65435c93ad24a4cbb5cd1779aeb2bda (diff)
Merged r22308. [ruby-dev:39637]
* 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@25661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_hash.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index f2ff95464d..71cf8dab93 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -637,7 +637,16 @@ class TestHash < Test::Unit::TestCase
def test_hash_hash
assert_equal({0=>2,11=>1}.hash, {11=>1,0=>2}.hash)
- assert_equal({:a=>2**29}.hash, {:a=>2**29}.hash)
- assert_equal({:a=>2**61}.hash, {:a=>2**61}.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