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

ruby-changes:37125

From: nobu <ko1@a...>
Date: Sat, 10 Jan 2015 21:24:27 +0900 (JST)
Subject: [ruby-changes:37125] nobu:r49206 (trunk): test/unit.rb: --excludes-dir list

nobu	2015-01-10 21:24:19 +0900 (Sat, 10 Jan 2015)

  New Revision: 49206

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

  Log:
    test/unit.rb: --excludes-dir list
    
    * test/lib/test/unit.rb (ExcludesOption): allow directory list by
      PATH_SEPARATOR to --excludes-dir option.

  Modified files:
    trunk/test/lib/test/unit.rb
Index: test/lib/test/unit.rb
===================================================================
--- test/lib/test/unit.rb	(revision 49205)
+++ test/lib/test/unit.rb	(revision 49206)
@@ -857,26 +857,32 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L857
           end
         end
 
-        def self.load(dir, name)
-          return unless dir and name
-          path = File.join(dir, name.gsub(/::/, '/') + ".rb")
-          begin
-            src = File.read(path)
-          rescue Errno::ENOENT
-            nil
-          else
-            instance = new({})
-            instance.instance_eval(src)
-            instance
+        def self.load(dirs, name)
+          return unless dirs and name
+          instance = nil
+          dirs.each do |dir|
+            path = File.join(dir, name.gsub(/::/, '/') + ".rb")
+            begin
+              src = File.read(path)
+            rescue Errno::ENOENT
+              nil
+            else
+              instance ||= new({})
+              instance.instance_eval(src)
+            end
           end
+          instance
         end
       end
 
       def setup_options(parser, options)
         super
-        options[:excludes] = ENV["EXCLUDES"]
+        if excludes = ENV["EXCLUDES"]
+          excludes = excludes.split(File::PATH_SEPARATOR)
+        end
+        options[:excludes] = excludes || []
         parser.on '-X', '--excludes-dir DIRECTORY', "Directory name of exclude files" do |d|
-          options[:excludes] = d
+          options[:excludes].concat d.split(File::PATH_SEPARATOR)
         end
       end
 

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

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