Sha256: da7806618ef8d7443dee6271bb94e0720bf701d5562c4eda2b20b422f6ba1b40

Contents?: true

Size: 811 Bytes

Versions: 10

Compression:

Stored size: 811 Bytes

Contents

#!/usr/bin/env ruby
# encoding: UTF-8

require File.expand_path('../test_helper', __FILE__)

class CallInfoVisitorTest < TestCase
  def setup
    # Need to use wall time for this test due to the sleep calls
    RubyProf::measure_mode = RubyProf::WALL_TIME
  end

  def test_visit
    result = RubyProf.profile do
      RubyProf::C1.hello
    end

    visitor = RubyProf::CallInfoVisitor.new(result.threads.first.top_call_infos)

    method_names = Array.new

    visitor.visit do |call_info, event|
      method_names << call_info.target.full_name if event == :enter
    end

    assert_equal(3, method_names.length)
    assert_equal("CallInfoVisitorTest#test_visit", method_names[0])
    assert_equal("<Class::RubyProf::C1>#hello", method_names[1])
    assert_equal("Kernel#sleep", method_names[2])
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
ruby-prof-0.17.0 test/call_info_visitor_test.rb
airbnb-ruby-prof-0.0.1 test/call_info_visitor_test.rb
ruby-prof-0.16.2 test/call_info_visitor_test.rb
ruby-prof-0.16.1 test/call_info_visitor_test.rb
ruby-prof-0.16.0 test/call_info_visitor_test.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/ruby-prof-0.15.9/test/call_info_visitor_test.rb
ruby-prof-0.15.9 test/call_info_visitor_test.rb
ruby-prof-0.15.8 test/call_info_visitor_test.rb
ruby-prof-0.15.7 test/call_info_visitor_test.rb
ruby-prof-0.15.6 test/call_info_visitor_test.rb