Sha256: edd253c0c93358481d2c540a25deeda64b120b5795b3dab9a3b4579698f6c78b

Contents?: true

Size: 767 Bytes

Versions: 12

Compression:

Stored size: 767 Bytes

Contents

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

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

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

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

      eval str
      Foo::Bar.new.foo
      DuplicateNamesTest.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 == 'DuplicateNamesTest::Foo::Bar#foo'
    end

    assert_equal(3, methods.length)
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
ruby-prof-1.7.1-x64-mingw-ucrt test/duplicate_names_test.rb
ruby-prof-1.7.1 test/duplicate_names_test.rb
ruby-prof-1.7.0-x64-mingw-ucrt test/duplicate_names_test.rb
ruby-prof-1.7.0 test/duplicate_names_test.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/ruby-prof-1.6.3/test/duplicate_names_test.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/ruby-prof-1.6.3/test/duplicate_names_test.rb
ruby-prof-1.6.3-x64-mingw-ucrt test/duplicate_names_test.rb
ruby-prof-1.6.3 test/duplicate_names_test.rb
ruby-prof-1.6.2-x64-mingw-ucrt test/duplicate_names_test.rb
ruby-prof-1.6.2 test/duplicate_names_test.rb
ruby-prof-1.6.1 test/duplicate_names_test.rb
ruby-prof-1.6.1-x64-mingw-ucrt test/duplicate_names_test.rb