1
0
Fork 0
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:
Marc-Andre Lafortune 2020-09-01 20:26:45 -04:00 committed by Marc-André Lafortune
parent 6e8ec9ab6d
commit 94b54b038c
Notes: git 2020-09-02 10:02:36 +09:00

View file

@ -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