Sha256: a6d0e50d88e552d647343b3ba2220b47655ef86333f3119dbb6eb00350b8a1cc

Contents?: true

Size: 723 Bytes

Versions: 21

Compression:

Stored size: 723 Bytes

Contents

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

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

class DuplicateNames < Test::Unit::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

21 entries across 19 versions & 2 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/ruby-prof-0.15.1/test/duplicate_names_test.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/ruby-prof-0.15.1/test/duplicate_names_test.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/ruby-prof-0.15.1/test/duplicate_names_test.rb
ruby-prof-0.15.2 test/duplicate_names_test.rb
ruby-prof-0.15.1 test/duplicate_names_test.rb
ruby-prof-0.15.0 test/duplicate_names_test.rb
ruby-prof-0.14.2 test/duplicate_names_test.rb
ruby-prof-0.14.1 test/duplicate_names_test.rb
ruby-prof-0.14.0 test/duplicate_names_test.rb
ruby-prof-0.13.1 test/duplicate_names_test.rb
ruby-prof-0.13.0 test/duplicate_names_test.rb
ruby-prof-0.12.2 test/duplicate_names_test.rb
ruby-prof-0.12.1-x86-mingw32 test/duplicate_names_test.rb
ruby-prof-0.12.1 test/duplicate_names_test.rb
ruby-prof-0.11.3 test/duplicate_names_test.rb
ruby-prof-0.11.2-x86-mingw32 test/duplicate_names_test.rb
ruby-prof-0.11.2 test/duplicate_names_test.rb
ruby-prof-0.11.0.rc3-x86-mingw32 test/duplicate_names_test.rb
ruby-prof-0.11.0.rc3 test/duplicate_names_test.rb
ruby-prof-0.11.0.rc2-x86-mingw32 test/duplicate_names_test.rb