Sha256: b053a7b109e6c1ba5906d25c4f0bf3f09d7f8f4ba57bee16903f5cbc940dd54b

Contents?: true

Size: 712 Bytes

Versions: 9

Compression:

Stored size: 712 Bytes

Contents

#!/usr/bin/env ruby

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

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
    
    methods = methods.select do |method|
      method.full_name == 'DuplicateNames::Foo::Bar#foo'
    end
    
    assert_equal(3, methods.length)
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
jeremy-ruby-prof-0.6.1 test/duplicate_names_test.rb
ruby-prof-0.5.2-mswin32 test/duplicate_names_test.rb
ruby-prof-0.5.1-mswin32 test/duplicate_names_test.rb
ruby-prof-0.5.0-mswin32 test/duplicate_names_test.rb
ruby-prof-0.5.2 test/duplicate_names_test.rb
ruby-prof-0.6.0 test/duplicate_names_test.rb
ruby-prof-0.6.0-x86-mswin32-60 test/duplicate_names_test.rb
ruby-prof-0.5.0 test/duplicate_names_test.rb
ruby-prof-0.5.1 test/duplicate_names_test.rb