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