Sha256: b2c1cb959e071e8b44518d7f24d6b6b0e7b72f2b3e57cb5c8e09d761c9eec42c

Contents?: true

Size: 699 Bytes

Versions: 23

Compression:

Stored size: 699 Bytes

Contents

#!/usr/bin/env ruby

require 'test/unit'
require 'ruby-prof'

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.values.first.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

23 entries across 23 versions & 5 rubygems

Version Path
adamh-ruby-prof-0.7.3 test/duplicate_names_test.rb
skaes-ruby-prof-0.7.3 test/duplicate_names_test.rb
ruby-prof-danielhoey-0.8.1 test/duplicate_names_test.rb
ruby-prof-0.8.2 test/duplicate_names_test.rb
ruby-prof-0.8.1-x86-mingw32 test/duplicate_names_test.rb
ruby-prof-0.8.1-x86-mswin32 test/duplicate_names_test.rb
ruby-prof-0.8.1 test/duplicate_names_test.rb
ruby-prof-0.7.10 test/duplicate_names_test.rb
ruby-prof-0.7.9 test/duplicate_names_test.rb
ruby-prof-0.7.8 test/duplicate_names_test.rb
ruby-prof-0.7.7 test/duplicate_names_test.rb
ruby-prof-0.7.6 test/duplicate_names_test.rb
ruby-prof-0.7.5 test/duplicate_names_test.rb
ruby-prof-0.7.4 test/duplicate_names_test.rb
rdp-ruby-prof-0.7.4 test/duplicate_names_test.rb
ruby-prof-0.7.0-x86-mswin32-60 test/duplicate_names_test.rb
ruby-prof-0.7.1-x86-mswin32-60 test/duplicate_names_test.rb
ruby-prof-0.7.3 test/duplicate_names_test.rb
ruby-prof-0.7.1 test/duplicate_names_test.rb
ruby-prof-0.7.0 test/duplicate_names_test.rb