[前][次][番号順一覧][スレッド一覧]

ruby-changes:10758

From: akr <ko1@a...>
Date: Sun, 15 Feb 2009 14:19:44 +0900 (JST)
Subject: [ruby-changes:10758] Ruby:r22323 (trunk): add a test.

akr	2009-02-15 14:19:39 +0900 (Sun, 15 Feb 2009)

  New Revision: 22323

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22323

  Log:
    add a test.

  Modified files:
    trunk/test/ruby/test_hash.rb

Index: test/ruby/test_hash.rb
===================================================================
--- test/ruby/test_hash.rb	(revision 22322)
+++ test/ruby/test_hash.rb	(revision 22323)
@@ -846,8 +846,23 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]