<commit_before>#!/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<commit_msg>Added "-1" instead of "_1" to method names as suggested by <NAME>.  See http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/198745<commit_after>#!/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
{'fraction_non_alphanumeric': 0.11603721948549535, 'fraction_numerical': 0.007662835249042145, 'mean_word_length': 4.134831460674158, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6174173', 'n_tokens_mistral': 739, 'n_tokens_neox': 622, 'n_words': 136}