diff options
author | sorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-21 06:14:24 +0000 |
---|---|---|
committer | sorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-21 06:14:24 +0000 |
commit | d5a190c942ae29a6a5035bc095ed7ea37f563487 (patch) | |
tree | 90a380ad6ca0031d8a5fa7f803f3304fe812b891 /lib/test/unit | |
parent | 3b15805c72b0c0b66acb38bafdb280d2d11136a4 (diff) | |
download | ruby-d5a190c942ae29a6a5035bc095ed7ea37f563487.tar.gz |
* 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
Diffstat (limited to 'lib/test/unit')
-rw-r--r-- | lib/test/unit/testcase.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/test/unit/testcase.rb b/lib/test/unit/testcase.rb index 11f34b6f51..59637e1234 100644 --- a/lib/test/unit/testcase.rb +++ b/lib/test/unit/testcase.rb @@ -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 |