summaryrefslogtreecommitdiff
path: root/spec/ruby/core/tracepoint/enable_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/tracepoint/enable_spec.rb')
-rw-r--r--spec/ruby/core/tracepoint/enable_spec.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/ruby/core/tracepoint/enable_spec.rb b/spec/ruby/core/tracepoint/enable_spec.rb
index aa0c3aa0dc9..13c7b82b54c 100644
--- a/spec/ruby/core/tracepoint/enable_spec.rb
+++ b/spec/ruby/core/tracepoint/enable_spec.rb
@@ -123,6 +123,18 @@ describe 'TracePoint#enable' do
end
describe "when nested" do
+ before do
+ ruby_version_is ""..."2.8" do
+ # Old behavior for Ruby < 2.8
+ @path_prefix = '@'
+ end
+
+ ruby_version_is "2.8" do
+ # New behavior for Ruby >= 2.8
+ @path_prefix = ' '
+ end
+ end
+
it "enables both TracePoints but only calls the respective callbacks" do
called = false
first = TracePoint.new(:line) do |tp|
@@ -146,7 +158,7 @@ describe 'TracePoint#enable' do
end
all.uniq.should == [second]
- inspects.uniq.should == ["#<TracePoint:line@#{__FILE__}:#{line}>"]
+ inspects.uniq.should == ["#<TracePoint:line#{@path_prefix}#{__FILE__}:#{line}>"]
called.should == true
end
end