diff options
Diffstat (limited to 'spec/ruby/core/tracepoint/path_spec.rb')
-rw-r--r-- | spec/ruby/core/tracepoint/path_spec.rb | 18 |
1 files changed, 18 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..61592f5106 --- /dev/null +++ b/spec/ruby/core/tracepoint/path_spec.rb @@ -0,0 +1,18 @@ +require File.expand_path('../../../spec_helper', __FILE__) + +describe 'TracePoint#path' do + it 'returns the path of the file being run' do + path = nil + TracePoint.new(:line) { |tp| path = tp.path }.enable do + path.should == "#{__FILE__}" + end + end + + it 'equals (eval) inside an eval for :end event' do + path = nil + TracePoint.new(:end) { |tp| path = tp.path }.enable do + eval("class A; end") + path.should == '(eval)' + end + end +end |