HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-2.7.4/spec/ruby/core/tracepoint/inspect_spec.rb
require_relative '../../spec_helper'
require_relative 'fixtures/classes'

describe 'TracePoint#inspect' do
  it 'returns a string containing a human-readable TracePoint status' do
    TracePoint.new(:line) {}.inspect.should ==
      '#<TracePoint:disabled>'
  end

  it 'returns a String showing the event, path and line' do
    inspect = nil
    line = __LINE__
    TracePoint.new(:line) { |tp| inspect = tp.inspect }.enable do
      inspect.should == "#<TracePoint:line@#{__FILE__}:#{line+2}>"
    end
  end

  it 'returns a String showing the event, path and line for a :class event' do
    inspect = nil
    line = __LINE__
    TracePoint.new(:class) { |tp| inspect = tp.inspect }.enable do
      class TracePointSpec::C
      end
    end

    inspect.should == "#<TracePoint:class@#{__FILE__}:#{line+2}>"
  end
end