summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-05 05:01:12 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-05 05:01:12 +0000
commitda19797648fae92b0e283ce4cdf84fb20bfc89a6 (patch)
treea5f81abc527c9cccf66c40cda97abb27732a32aa /test
parentc82826ce5f90f2b678b5e42309c4fd226863230f (diff)
* range.c (range_eql, range_eq): fixed equality to work for
subclasses of Range. a patch from Marc-Andre Lafortune. [ruby-core:22190] * test/ruby/test_range.rb: add assertions for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_range.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb
index b4c0789..9dfd290 100644
--- a/test/ruby/test_range.rb
+++ b/test/ruby/test_range.rb
@@ -89,6 +89,8 @@ class TestRange < Test::Unit::TestCase
assert(r != (1..2))
assert(r != (0..2))
assert(r != (0...1))
+ subclass = Class.new(Range)
+ assert(r == subclass.new(0,1))
end
def test_eql
@@ -99,6 +101,8 @@ class TestRange < Test::Unit::TestCase
assert(!r.eql?(1..2))
assert(!r.eql?(0..2))
assert(!r.eql?(0...1))
+ subclass = Class.new(Range)
+ assert(r.eql?(subclass.new(0,1)))
end
def test_hash