summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-03-07 17:52:18 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2025-03-07 17:52:18 +0900
commitf118e0ce734d7951597eddccff3695d6573589c4 (patch)
treef96ee4365ae4e93d59724f0148884a8bf4409545
parentcbe3156f82ee8b68e734be58badb9b6a3adc8aa6 (diff)
[Bug #21174] [Bug #21175] Update rubyspec
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12879
-rw-r--r--spec/ruby/core/range/max_spec.rb20
1 files 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