1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/test/unit/testcase.rb(method_added): refactoring.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
sorah 2012-07-21 06:14:24 +00:00
parent 3b15805c72
commit d5a190c942
2 changed files with 11 additions and 9 deletions

View file

@ -1,6 +1,10 @@
Sat Jul 21 15:13:42 2012 Shota Fukumori <sorah@tubusu.net>
* lib/test/unit/testcase.rb(method_added): refactoring.
Sat Jul 21 14:06:41 2012 Shota Fukumori <sorah@tubusu.net>
* lib/test/unit.rb: warn when test_* method is redefined.
* lib/test/unit/testcase.rb: warn when test_* method is redefined.
Patch by mame (Yusuke Endoh). [Feature #2643] [ruby-core:27790]
* test/testunit/test_redefinition.rb: Test for above.

View file

@ -21,15 +21,13 @@ module Test
:sorted
end
Methods = {}
def self.method_added(name)
return unless name.to_s[/\Atest_/]
Methods[self] ||= {}
if Methods[self][name]
warn("test/unit warning: method #{ self }##{ name } is redefined")
end
Methods[self][name] = true
return unless name.to_s.start_with?("test_")
@test_methods ||= {}
if @test_methods[name]
warn "test/unit warning: method #{ self }##{ name } is redefined"
end
@test_methods[name] = true
end
end
end