Project

General

Profile

Feature #8184 ยป range_init_patch.diff

phi (Pascal Hurni), 03/29/2013 11:16 PM

View differences:

range.c
static VALUE
range_check(VALUE *args)
{
if (args[0] == Qnil || args[0] == Qfalse || args[0] == Qtrue)
return Qnil;
return rb_funcall(args[0], id_cmp, 1, args[1]);
}
test/ruby/test_range.rb
assert_raise(ArgumentError) { (1 .. :a) }
end
def test_nil_false_true_ranges
[nil, false, true].each {|value| assert_raise(ArgumentError) { (value..value) } }
end
def test_exclude_end
assert(!((0..1).exclude_end?))
assert((0...1).exclude_end?)
    (1-1/1)