summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-25 04:44:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-25 04:44:36 +0000
commitd6ab828369b8ab6995b47abd9ab5982618c2d334 (patch)
tree8ca4432cd0897c37d450a98f305897c7cbb567c8 /test/ruby
parent4fd615943ed879a3694bd986f48a52486c7c52e1 (diff)
* complex.c (nucomp_hash), rational.c (nurat_hash): not to use
hash value of class so that equality against subclasses can work. [ruby-dev:38850] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_complex.rb3
-rw-r--r--test/ruby/test_rational.rb4
2 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb
index ca26f45..6885294 100644
--- a/test/ruby/test_complex.rb
+++ b/test/ruby/test_complex.rb
@@ -36,6 +36,9 @@ class Complex_Test < Test::Unit::TestCase
assert_instance_of(ComplexSub, c5)
end
+ c1 = Complex(1)
+ assert_equal(c1.hash, c.hash, '[ruby-dev:38850]')
+ assert_equal([true, true], [c.eql?(c1), c1.eql?(c)])
end
def test_eql_p
diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb
index 85545fe..82313db 100644
--- a/test/ruby/test_rational.rb
+++ b/test/ruby/test_rational.rb
@@ -35,6 +35,10 @@ class Rational_Test < Test::Unit::TestCase
assert_equal(c, c5)
assert_instance_of(RationalSub, c5)
end
+
+ c1 = Rational(1)
+ assert_equal(c1.hash, c.hash, '[ruby-dev:38850]')
+ assert_equal([true, true], [c.eql?(c1), c1.eql?(c)])
end
def test_eql_p