* 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:
matz 2009-08-05 05:01:12 +00:00
parent c82826ce5f
commit da19797648
3 changed files with 14 additions and 2 deletions

View file

@ -125,7 +125,7 @@ range_eq(VALUE range, VALUE obj)
{
if (range == obj)
return Qtrue;
if (!rb_obj_is_instance_of(obj, rb_obj_class(range)))
if (!rb_obj_is_kind_of(obj, rb_cRange))
return Qfalse;
if (!rb_equal(RANGE_BEG(range), RANGE_BEG(obj)))
@ -187,7 +187,7 @@ range_eql(VALUE range, VALUE obj)
{
if (range == obj)
return Qtrue;
if (!rb_obj_is_instance_of(obj, rb_obj_class(range)))
if (!rb_obj_is_kind_of(obj, rb_cRange))
return Qfalse;
if (!rb_eql(RANGE_BEG(range), RANGE_BEG(obj)))