summaryrefslogtreecommitdiff
path: root/spec/ruby/core/thread/backtrace_locations_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/thread/backtrace_locations_spec.rb')
-rw-r--r--spec/ruby/core/thread/backtrace_locations_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/core/thread/backtrace_locations_spec.rb b/spec/ruby/core/thread/backtrace_locations_spec.rb
index ead4be2d8c..1f77e13378 100644
--- a/spec/ruby/core/thread/backtrace_locations_spec.rb
+++ b/spec/ruby/core/thread/backtrace_locations_spec.rb
@@ -51,6 +51,14 @@ describe "Thread#backtrace_locations" do
end
end
+ ruby_version_is "2.7" do
+ it "can be called with an beginless range" do
+ locations1 = Thread.current.backtrace_locations(0)
+ locations2 = Thread.current.backtrace_locations(eval("(..5)"))
+ locations2.map(&:to_s)[eval("(2..)")].should == locations1[eval("(..5)")].map(&:to_s)[eval("(2..)")]
+ end
+ end
+
it "returns nil if omitting more locations than available" do
Thread.current.backtrace_locations(100).should == nil
Thread.current.backtrace_locations(100..-1).should == nil