Sha256: eb3599352d0ec7800696515fabfd9bb07fd8c91c46cc6a8fcc46aaffd18c0e0e

Contents?: true

Size: 759 Bytes

Versions: 6

Compression:

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

6 entries across 6 versions & 1 rubygems

Version Path
ruby-prof-1.5.0-x64-mingw-ucrt test/duplicate_names_test.rb
ruby-prof-1.5.0 test/duplicate_names_test.rb
ruby-prof-1.4.5-x64-mingw-ucrt test/duplicate_names_test.rb
ruby-prof-1.4.5 test/duplicate_names_test.rb
ruby-prof-1.4.4-x64-mingw-ucrt test/duplicate_names_test.rb
ruby-prof-1.4.4 test/duplicate_names_test.rb