summaryrefslogtreecommitdiff
path: root/spec/ruby/core/range/last_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/range/last_spec.rb')
-rw-r--r--spec/ruby/core/range/last_spec.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/spec/ruby/core/range/last_spec.rb b/spec/ruby/core/range/last_spec.rb
index 54884ba4d6..6698686dd5 100644
--- a/spec/ruby/core/range/last_spec.rb
+++ b/spec/ruby/core/range/last_spec.rb
@@ -8,6 +8,12 @@ describe "Range#last" do
(1..5).last(3).should == [3, 4, 5]
end
+ ruby_bug '#18994', '2.7'...'3.2' do
+ it "returns the specified number if elements for single element inclusive range" do
+ (1..1).last(1).should == [1]
+ end
+ end
+
it "returns an empty array for an empty Range" do
(0...0).last(2).should == []
end
@@ -47,9 +53,7 @@ describe "Range#last" do
-> { (2..3).last("1") }.should raise_error(TypeError)
end
- ruby_version_is "2.6" do
- it "raises a RangeError when called on an endless range" do
- -> { eval("(1..)").last }.should raise_error(RangeError)
- end
+ it "raises a RangeError when called on an endless range" do
+ -> { eval("(1..)").last }.should raise_error(RangeError)
end
end