mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
c82826ce5f
commit
da19797648
3 changed files with 14 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue