aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-11 23:37:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-11 23:37:15 +0000
commit79654f3fd3b39938dd7f7d3ea231a8faf74167b2 (patch)
tree0a09891d3d08aa72160ca3d1449136e70edbac8d /test
parent5a17f4c4a341618d2d25c03c64ac72d71234303a (diff)
downloadruby-79654f3fd3b39938dd7f7d3ea231a8faf74167b2.tar.gz
* hash.c (hash_i): return different values for inverse hash.
[ruby-core:34334] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_hash.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 782edc9a0c..4c0d556896 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -890,7 +890,7 @@ class TestHash < Test::Unit::TestCase
assert_equal({x=>1}.hash, {x=>1}.hash)
o = Object.new
- def o.hash; 2<<100; end
+ def o.hash; 2 << 100; end
assert_equal({x=>1}.hash, {x=>1}.hash)
end
@@ -904,4 +904,11 @@ class TestHash < Test::Unit::TestCase
h.rehash
assert_equal(:foo, h[h])
end
+
+ def test_inverse_hash
+ feature4262 = '[ruby-core:34334]'
+ [{1=>2}, {123=>"abc"}].each do |h|
+ assert_not_equal(h.hash, h.invert.hash, feature4262)
+ end
+ end
end