summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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