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

ruby-changes:18829

From: nobu <ko1@a...>
Date: Sun, 13 Feb 2011 00:29:30 +0900 (JST)
Subject: [ruby-changes:18829] Ruby:r30854 (trunk): * lib/test/unit.rb (Test::Unit::Options#process_args): always

nobu	2011-02-13 00:29:24 +0900 (Sun, 13 Feb 2011)

  New Revision: 30854

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

  Log:
    * lib/test/unit.rb (Test::Unit::Options#process_args): always
      return options.
    * lib/test/unit.rb (Test::Unit::RequireFiles#non_options): return
      if any test case get loaded.
    * lib/test/unit.rb (Test::Unit::AutoRunner#initialize): do not add
      default directory if it is nil.
    * lib/test/unit.rb (Test::Unit::AutoRunner#process_args): return
      true if any test cases to run.

  Modified files:
    trunk/ChangeLog
    trunk/bin/testrb
    trunk/lib/test/unit.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30853)
+++ ChangeLog	(revision 30854)
@@ -1,3 +1,17 @@
+Sun Feb 13 00:29:18 2011  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/test/unit.rb (Test::Unit::Options#process_args): always
+	  return options.
+
+	* lib/test/unit.rb (Test::Unit::RequireFiles#non_options): return
+	  if any test case get loaded.
+
+	* lib/test/unit.rb (Test::Unit::AutoRunner#initialize): do not add
+	  default directory if it is nil.
+
+	* lib/test/unit.rb (Test::Unit::AutoRunner#process_args): return
+	  true if any test cases to run.
+
 Sat Feb 12 23:17:43 2011  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/test/unit.rb (assert_include): add alias.
Index: lib/test/unit.rb
===================================================================
--- lib/test/unit.rb	(revision 30853)
+++ lib/test/unit.rb	(revision 30854)
@@ -48,7 +48,7 @@
         opts.parse!(args)
         orig_args -= args
         args = @init_hook.call(args, options) if @init_hook
-        non_options(args, options) or return nil
+        non_options(args, options)
         @help = orig_args.map { |s| s =~ /[\s|&<>$()]/ ? s.inspect : s }.join " "
         @options = options
       end
@@ -167,7 +167,8 @@
 
     module RequireFiles
       def non_options(files, options)
-        return false if !super or files.empty?
+        return false if !super
+        result = false
         files.each {|f|
           d = File.dirname(path = File.expand_path(f))
           unless $:.include? d
@@ -175,10 +176,12 @@
           end
           begin
             require path
+            result = true
           rescue LoadError
             puts "#{f}: #{$!}"
           end
         }
+        result
       end
     end
 
@@ -227,7 +230,7 @@
       def initialize(force_standalone = false, default_dir = nil, argv = ARGV)
         @runner = Runner.new do |files, options|
           options[:base_directory] ||= default_dir
-          files << default_dir if files.empty?
+          files << default_dir if files.empty? and default_dir
           @to_run = files
           yield self if block_given?
           files
@@ -238,6 +241,7 @@
 
       def process_args(*args)
         @runner.process_args(*args)
+        !@to_run.empty?
       end
 
       def run
Index: bin/testrb
===================================================================
--- bin/testrb	(revision 30853)
+++ bin/testrb	(revision 30854)
@@ -5,6 +5,6 @@
 unless tests.process_args(ARGV)
   abort tests.options.banner
 end
-p files = tests.to_run
+files = tests.to_run
 $0 = files.size == 1 ? File.basename(files[0]) : files.to_s
 exit tests.run

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

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