summaryrefslogtreecommitdiff
path: root/spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb')
-rw-r--r--spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb b/spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb
index b0ae28beee..4136f09348 100644
--- a/spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb
+++ b/spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb
@@ -18,10 +18,20 @@ describe 'Thread::Backtrace::Location#absolute_path' do
end
context "when used in eval with a given filename" do
- it "returns filename" do
- code = "caller_locations(0)[0].absolute_path"
- eval(code, nil, "foo.rb").should == "foo.rb"
- eval(code, nil, "foo/bar.rb").should == "foo/bar.rb"
+ code = "caller_locations(0)[0].absolute_path"
+
+ ruby_version_is ""..."3.1" do
+ it "returns filename with absolute_path" do
+ eval(code, nil, "foo.rb").should == "foo.rb"
+ eval(code, nil, "foo/bar.rb").should == "foo/bar.rb"
+ end
+ end
+
+ ruby_version_is "3.1" do
+ it "returns nil with absolute_path" do
+ eval(code, nil, "foo.rb").should == nil
+ eval(code, nil, "foo/bar.rb").should == nil
+ end
end
end