Sha256: ccfcb89970fe5d3113340e1a0cf84502219b9441826b74301796f18320f0f75c

Contents?: true

Size: 743 Bytes

Versions: 20

Compression:

Stored size: 743 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

20 entries across 20 versions & 2 rubygems

Version Path
ruby-prof-1.4.3-x64-mingw32 test/duplicate_names_test.rb
ruby-prof-1.4.3 test/duplicate_names_test.rb
ruby-prof-1.4.2-x64-mingw32 test/duplicate_names_test.rb
ruby-prof-1.4.2 test/duplicate_names_test.rb
ruby-prof-1.4.1-x64-mingw32 test/duplicate_names_test.rb
ruby-prof-1.4.1 test/duplicate_names_test.rb
ruby-prof-1.4.0-x64-mingw32 test/duplicate_names_test.rb
ruby-prof-1.4.0 test/duplicate_names_test.rb
ruby-prof-1.3.2 test/duplicate_names_test.rb
ruby-prof-1.3.1-x64-mingw32 test/duplicate_names_test.rb
ruby-prof-1.3.1 test/duplicate_names_test.rb
ruby-prof-1.3.0-x64-mingw32 test/duplicate_names_test.rb
ruby-prof-1.3.0 test/duplicate_names_test.rb
ruby-prof-1.2.0 test/duplicate_names_test.rb
ruby-prof-1.1.0-x64-mingw32 test/duplicate_names_test.rb
ruby-prof-1.1.0 test/duplicate_names_test.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/ruby-prof-0.18.0/test/duplicate_names_test.rb
ruby-prof-1.0.0 test/duplicate_names_test.rb
ruby-prof-0.18.0-x64-mingw32 test/duplicate_names_test.rb
ruby-prof-0.18.0 test/duplicate_names_test.rb