mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Reapply "Special case Range#max for integer beginning and Float::Infinity end" (tests)
Reverted in e080a4cdee
This commit is contained in:
parent
6e8ec9ab6d
commit
94b54b038c
Notes:
git
2020-09-02 10:02:36 +09:00
1 changed files with 6 additions and 0 deletions
|
@ -129,6 +129,9 @@ class TestRange < Test::Unit::TestCase
|
|||
assert_equal(2, (..2).max)
|
||||
assert_raise(TypeError) { (...2).max }
|
||||
assert_raise(TypeError) { (...2.0).max }
|
||||
|
||||
assert_equal(Float::INFINITY, (1..Float::INFINITY).max)
|
||||
assert_nil((1..-Float::INFINITY).max)
|
||||
end
|
||||
|
||||
def test_minmax
|
||||
|
@ -153,6 +156,9 @@ class TestRange < Test::Unit::TestCase
|
|||
|
||||
assert_equal(['a', 'c'], ('a'..'c').minmax)
|
||||
assert_equal(['a', 'b'], ('a'...'c').minmax)
|
||||
|
||||
assert_equal([1, Float::INFINITY], (1..Float::INFINITY).minmax)
|
||||
assert_equal([nil, nil], (1..-Float::INFINITY).minmax)
|
||||
end
|
||||
|
||||
def test_initialize_twice
|
||||
|
|
Loading…
Add table
Reference in a new issue