summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-15 05:19:39 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-15 05:19:39 +0000
commit08638ed7b837bef4ec94bd56e38941e737e42f5d (patch)
tree97cedaaed0e82a2dfe32792a41084e9785978f34 /test
parentb955b34d5fe4792bb85742ced659b1d2b1d74d6a (diff)
add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_hash.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 50a34b8160..06f3b7c6e5 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -846,8 +846,23 @@ class TestHash < Test::Unit::TestCase
assert_nil(h["foo"])
end
+ class ObjWithHash
+ def initialize(value, hash)
+ @value = value
+ @hash = hash
+ end
+ attr_reader :value, :hash
+
+ def eql?(other)
+ @value == other.value
+ end
+ end
+
def test_hash_hash
assert_equal({0=>2,11=>1}.hash, {11=>1,0=>2}.hash)
+ o1 = ObjWithHash.new(0,1)
+ o2 = ObjWithHash.new(11,1)
+ assert_equal({o1=>1,o2=>2}.hash, {o2=>2,o1=>1}.hash)
end
def test_hash_bignum_hash