ruby-changes:62801
From: Marc-Andre <ko1@a...>
Date: Wed, 2 Sep 2020 10:02:30 +0900 (JST)
Subject: [ruby-changes:62801] 94b54b038c (master): Reapply "Special case Range#max for integer beginning and Float::Infinity end" (tests)
https://git.ruby-lang.org/ruby.git/commit/?id=94b54b038c From 94b54b038c1f4d6d2b54e10dd0305b1bc283449b Mon Sep 17 00:00:00 2001 From: Marc-Andre Lafortune <github@m...> Date: Tue, 1 Sep 2020 20:26:45 -0400 Subject: Reapply "Special case Range#max for integer beginning and Float::Infinity end" (tests) Reverted in e080a4cdee diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb index 07a0928..9c8bbaf 100644 --- a/test/ruby/test_range.rb +++ b/test/ruby/test_range.rb @@ -129,6 +129,9 @@ class TestRange < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_range.rb#L129 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_range.rb#L156 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/