Skip to content

Commit da400da

Browse files
committed
Move Thread::Backtrace::Location specs from TruffleRuby
* And generalize them so they are valid for all Ruby implementations.
1 parent 37a5572 commit da400da

File tree

4 files changed

+22
-51
lines changed

4 files changed

+22
-51
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,14 @@
1010
it 'returns the absolute path of the call frame' do
1111
@frame.lineno.should == @line
1212
end
13+
14+
it 'should be the same line number as in #to_s, including for core methods' do
15+
# Get the caller_locations from a call made into a core library method
16+
locations = [:non_empty].map { caller_locations }[0]
17+
18+
locations.each do |location|
19+
line_number = location.to_s[/:(\d+):/, 1]
20+
location.lineno.should == Integer(line_number)
21+
end
22+
end
1323
end

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@
8787
end
8888
end
8989

90+
it 'should be the same path as in #to_s, including for core methods' do
91+
# Get the caller_locations from a call made into a core library method
92+
locations = [:non_empty].map { caller_locations }[0]
93+
94+
locations.each do |location|
95+
filename = location.to_s[/^(.+):\d+:/, 1]
96+
path = location.path
97+
98+
path.should == filename
99+
end
100+
end
101+
90102
context "canonicalization" do
91103
platform_is_not :windows do
92104
before :each do

spec/truffle/thread/backtrace/location/lineno_spec.rb

Lines changed: 0 additions & 23 deletions
This file was deleted.

spec/truffle/thread/backtrace/location/path_spec.rb

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)