diff options
Diffstat (limited to 'spec/ruby/core/tracepoint/path_spec.rb')
| -rw-r--r-- | spec/ruby/core/tracepoint/path_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/ruby/core/tracepoint/path_spec.rb b/spec/ruby/core/tracepoint/path_spec.rb new file mode 100644 index 0000000000..aa6868ead2 --- /dev/null +++ b/spec/ruby/core/tracepoint/path_spec.rb @@ -0,0 +1,26 @@ +require_relative '../../spec_helper' +require_relative 'fixtures/classes' + +describe 'TracePoint#path' do + it 'returns the path of the file being run' do + path = nil + TracePoint.new(:line) { |tp| + next unless TracePointSpec.target_thread? + path = tp.path + }.enable do + line_event = true + end + path.should == "#{__FILE__}" + end + + it 'equals "(eval at __FILE__:__LINE__)" inside an eval for :end event' do + path = nil + TracePoint.new(:end) { |tp| + next unless TracePointSpec.target_thread? + path = tp.path + }.enable do + eval("module TracePointSpec; end") + end + path.should == "(eval at #{__FILE__}:#{__LINE__ - 2})" + end +end |
