summaryrefslogtreecommitdiff
path: root/test/lib/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-09 01:28:20 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-09 01:28:20 +0000
commitbfd1fbf09829eb138896138c72bf4dea88cb56c8 (patch)
tree51b3dc10054d7f38556680bfe05ef816bd061129 /test/lib/test
parent031c46f83a0b64e6accde30b2a4b92c6d21650e0 (diff)
test/unit.rb: regexps to exclude
* test/lib/test/unit.rb (ExcludedMethods#exclude_from): allow regexps for methods to be excluded. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/lib/test')
-rw-r--r--test/lib/test/unit.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb
index 6dc702863c..c088d98068 100644
--- a/test/lib/test/unit.rb
+++ b/test/lib/test/unit.rb
@@ -843,14 +843,17 @@ module Test
def exclude_from(klass)
excludes = self.excludes
+ pattern = excludes.keys.grep(Regexp).tap {|k|
+ break (Regexp.new(k.join('|')) unless k.empty?)
+ }
klass.class_eval do
public_instance_methods(false).each do |method|
- if excludes[method]
+ if excludes[method] or (pattern and pattern =~ method)
remove_method(method)
end
end
public_instance_methods(true).each do |method|
- if excludes[method]
+ if excludes[method] or (pattern and pattern =~ method)
undef_method(method)
end
end