diff options
author | Marc-Andre Lafortune <github@marc-andre.ca> | 2020-09-01 20:26:45 -0400 |
---|---|---|
committer | Marc-André Lafortune <github@marc-andre.ca> | 2020-09-01 21:02:12 -0400 |
commit | 94b54b038c1f4d6d2b54e10dd0305b1bc283449b (patch) | |
tree | bbe00e5f607f75781f5fd4140a48322963fa8fde | |
parent | 6e8ec9ab6da228ade70fe7d0dd16540d8f859f00 (diff) |
Reapply "Special case Range#max for integer beginning and Float::Infinity end" (tests)
Reverted in e080a4cdee
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3501
-rw-r--r-- | test/ruby/test_range.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb index 07a092858e..9c8bbaf239 100644 --- a/test/ruby/test_range.rb +++ b/test/ruby/test_range.rb @@ -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 |