From 8a5ad2b77d7a24e4f8f4fef179ae5efced935f91 Mon Sep 17 00:00:00 2001 From: Michael Kohl Date: Sat, 18 Jul 2020 23:18:40 +0700 Subject: Fix Range#max for beginless Integer ranges [Bug #17034] * Fix Range#max for beginless Integer ranges * Update test/ruby/test_range.rb * Fix formatting https://github.com/ruby/ruby/pull/3328 Co-authored-by: Nobuyoshi Nakada --- test/ruby/test_range.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb index 9052fe6174..0b3f6c68f6 100644 --- a/test/ruby/test_range.rb +++ b/test/ruby/test_range.rb @@ -127,6 +127,10 @@ class TestRange < Test::Unit::TestCase assert_raise(RangeError) { (1...).max(3) } assert_raise(RangeError) { (..0).min {|a, b| a <=> b } } + + assert_equal(2, (..2).max) + assert_raise(TypeError) { (...2).max } + assert_raise(TypeError) { (...2.0).max } end def test_minmax -- cgit v1.2.3