mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* range.c (range_max, range_min): return nil for empty set as well as
1.8 and Enumerable. [ruby-dev:31198] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
608545ced0
commit
113a709cce
3 changed files with 13 additions and 1 deletions
|
@ -40,6 +40,9 @@ class TestRange < Test::Unit::TestCase
|
|||
assert_equal(1.0, (1.0..2.0).min)
|
||||
assert_equal(nil, (2.0..1.0).min)
|
||||
assert_equal(1, (1.0...2.0).min)
|
||||
|
||||
assert_equal(0, (0..0).min)
|
||||
assert_equal(nil, (0...0).min)
|
||||
end
|
||||
|
||||
def test_max
|
||||
|
@ -52,5 +55,8 @@ class TestRange < Test::Unit::TestCase
|
|||
assert_raise(TypeError) { (1.0...2.0).max }
|
||||
|
||||
assert_equal(-0x80000002, ((-0x80000002)...(-0x80000001)).max)
|
||||
|
||||
assert_equal(0, (0..0).max)
|
||||
assert_equal(nil, (0...0).max)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue