Sha256: bfa698230c83733f654bf5b68220a1fb0ee6f61e30d3bc480a312883ebd0b9ff

Contents?: true

Size: 825 Bytes

Versions: 2

Compression:

Stored size: 825 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
		print_results(result)
		
		# There should be 3 foo methods
		methods = result.threads.values.first
		
		method_info = methods['DuplicateNames::Foo::Bar#foo']
		assert_not_nil(method_info)
		
		method_info = methods['DuplicateNames::Foo::Bar#foo_1']
		assert_not_nil(method_info)
		
		method_info = methods['DuplicateNames::Foo::Bar#foo_2']
		assert_not_nil(method_info)
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-prof-0.4.1-mswin32 test/duplicate_names_test.rb
ruby-prof-0.4.1 test/duplicate_names_test.rb