[前][次][番号順一覧][スレッド一覧]

ruby-changes:37468

From: nobu <ko1@a...>
Date: Mon, 9 Feb 2015 10:28:43 +0900 (JST)
Subject: [ruby-changes:37468] nobu:r49549 (trunk): test/unit.rb: regexps to exclude

nobu	2015-02-09 10:28:20 +0900 (Mon, 09 Feb 2015)

  New Revision: 49549

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49549

  Log:
    test/unit.rb: regexps to exclude
    
    * test/lib/test/unit.rb (ExcludedMethods#exclude_from): allow
      regexps for methods to be excluded.

  Modified files:
    trunk/test/lib/test/unit.rb
Index: test/lib/test/unit.rb
===================================================================
--- test/lib/test/unit.rb	(revision 49548)
+++ test/lib/test/unit.rb	(revision 49549)
@@ -843,14 +843,17 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L843
 
         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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]