Sha256: d3b65c51420a2211b828e510e5db6fde7cb869d335fb40fe309cba7f7755e621

Contents?: true

Size: 711 Bytes

Versions: 13

Compression:

Stored size: 711 Bytes

Contents

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

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

class DuplicateNames < TestCase
  def test_names
    result = RubyProf::profile do
      str = %{module Foo; class Bar; def foo; end end end}

      eval str
      Foo::Bar.new.foo
      DuplicateNames.class_eval {remove_const :Foo}

      eval str
      Foo::Bar.new.foo
      DuplicateNames.class_eval {remove_const :Foo}

      eval str
      Foo::Bar.new.foo
    end

    # There should be 3 foo methods
    methods = result.threads.first.methods.sort.reverse

    methods = methods.select do |method|
      method.full_name == 'DuplicateNames::Foo::Bar#foo'
    end

    assert_equal(3, methods.length)
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

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