File tree Expand file tree Collapse file tree 3 files changed +15
-11
lines changed
spec/truffle/thread/backtrace/location Expand file tree Collapse file tree 3 files changed +15
-11
lines changed Original file line number Diff line number Diff line change 10
10
11
11
describe 'Thread::Backtrace::Location#absolute_path' do
12
12
13
- it 'should be the same absolute path as in the formatted description for core methods' do
13
+ it 'returns an existing and canonical path for core methods' do
14
14
# Get the caller_locations from a call made into a core method.
15
15
locations = [ :non_empty ] . map { caller_locations } . flatten
16
16
17
17
locations . each do |location |
18
- filename , _line_number , _in_method = location . to_s . split ( ':' )
19
18
path = location . absolute_path
19
+ path . should_not . include? ( '(core)' )
20
20
21
- path . should_not == '(core)'
22
- path . start_with? ( 'resource:/' ) . should be_false
23
- location . absolute_path . should == File . expand_path ( filename )
21
+ if path . include? ( 'resource:' )
22
+ skip
23
+ else
24
+ File . should . exist? ( location . absolute_path )
25
+ File . realpath ( location . absolute_path ) . should == location . absolute_path
26
+ end
24
27
end
25
28
end
26
29
Original file line number Diff line number Diff line change 15
15
locations = [ :non_empty ] . map { caller_locations } . flatten
16
16
17
17
locations . each do |location |
18
- _filename , line_number , _in_method = location . to_s . split ( ':' )
19
- location . lineno . should == line_number . to_i
18
+ line_number = location . to_s [ /:( \d +):/ , 1 ]
19
+ location . lineno . should == Integer ( line_number )
20
20
end
21
21
end
22
22
Original file line number Diff line number Diff line change 15
15
locations = [ :non_empty ] . map { caller_locations } . flatten
16
16
17
17
locations . each do |location |
18
- filename , _line_number , _in_method = location . to_s . split ( ':' )
18
+ filename = location . to_s [ /^(.+): \d +:/ , 1 ]
19
19
path = location . path
20
+ path . should_not . include? ( '(core)' )
21
+ path . should_not . include? ( 'resource:' )
20
22
21
- path . should_not == '(core)'
22
- path . start_with? ( 'resource:/' ) . should be_false
23
- File . basename ( path ) . should == File . basename ( filename )
23
+ # #path is consistent with #to_s output, like on MRI
24
+ path . should == filename
24
25
end
25
26
end
26
27
You can’t perform that action at this time.
0 commit comments