From f118e0ce734d7951597eddccff3695d6573589c4 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 7 Mar 2025 17:52:18 +0900 Subject: [PATCH] [Bug #21174] [Bug #21175] Update rubyspec --- spec/ruby/core/range/max_spec.rb | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/spec/ruby/core/range/max_spec.rb b/spec/ruby/core/range/max_spec.rb index a3bbc31e7d..8b83f69a5a 100644 --- a/spec/ruby/core/range/max_spec.rb +++ b/spec/ruby/core/range/max_spec.rb @@ -55,10 +55,24 @@ describe "Range#max" do (..1.0).max.should == 1.0 end - it "raises for an exclusive beginless range" do + ruby_version_is ""..."3.5" do + it "raises for an exclusive beginless Integer range" do + -> { + (...1).max + }.should raise_error(TypeError, 'cannot exclude end value with non Integer begin value') + end + end + + ruby_version_is "3.5" do + it "returns the end point for exclusive beginless Integer ranges" do + (...1).max.should == 0 + end + end + + it "raises for an exclusive beginless non Integer range" do -> { - (...1).max - }.should raise_error(TypeError, 'cannot exclude end value with non Integer begin value') + (...1.0).max + }.should raise_error(TypeError, 'cannot exclude non Integer end value') end end