From 5b0efd3932a51dc0d0c003f8f1509248066f8050 Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 15 Feb 2009 05:19:39 +0000 Subject: add a test. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_hash.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') 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 -- cgit