Skip to content

Commit d276418

Browse files
committed
Add spec for Thread::Backtrace::Location#absolute_path with a relative main script
(cherry picked from commit 767f295)
1 parent 5f1afc7 commit d276418

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

spec/ruby/core/thread/backtrace/location/absolute_path_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
@frame.absolute_path.should == File.realpath(__FILE__)
1111
end
1212

13+
it 'returns an absolute path when using a relative main script path' do
14+
script = fixture(__FILE__, 'absolute_path_main.rb')
15+
Dir.chdir(File.dirname(script)) do
16+
ruby_exe('absolute_path_main.rb').should == "absolute_path_main.rb\n#{script}\n"
17+
end
18+
end
19+
1320
context "when used in eval with a given filename" do
1421
it "returns filename" do
1522
code = "caller_locations(0)[0].absolute_path"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
puts __FILE__
2+
puts caller_locations(0)[0].absolute_path
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
slow:Thread::Backtrace::Location#absolute_path returns an absolute path when using a relative main script path

0 commit comments

Comments
 (0)