summaryrefslogtreecommitdiffstats
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
commit5b0efd3932a51dc0d0c003f8f1509248066f8050 (patch)
tree97cedaaed0e82a2dfe32792a41084e9785978f34 /test
parent67e8645e0491c505c8e3e0bdc27fc45030bd1de0 (diff)
downloadruby-5b0efd3932a51dc0d0c003f8f1509248066f8050.tar.gz
ruby-5b0efd3932a51dc0d0c003f8f1509248066f8050.tar.xz
ruby-5b0efd3932a51dc0d0c003f8f1509248066f8050.zip
add a test.
git-svn-id: http://svn.ruby-lang.org/repos/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 50a34b816..06f3b7c6e 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