Project

General

Profile

Feature #8184 ยป range_init_patch.diff

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

View differences:

range.c
39 39
static VALUE
40 40
range_check(VALUE *args)
41 41
{
42
    if (args[0] == Qnil || args[0] == Qfalse || args[0] == Qtrue)
43
      return Qnil;
44

  
42 45
    return rb_funcall(args[0], id_cmp, 1, args[1]);
43 46
}
44 47

  
test/ruby/test_range.rb
95 95
    assert_raise(ArgumentError) { (1 .. :a) }
96 96
  end
97 97

  
98
  def test_nil_false_true_ranges
99
    [nil, false, true].each {|value| assert_raise(ArgumentError) { (value..value) } }
100
  end
101

  
98 102
  def test_exclude_end
99 103
    assert(!((0..1).exclude_end?))
100 104
    assert((0...1).exclude_end?)