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

ruby-changes:25398

From: kou <ko1@a...>
Date: Sat, 3 Nov 2012 17:56:35 +0900 (JST)
Subject: [ruby-changes:25398] kou:r37455 (trunk): * bin/testrb: Use only Test::Unit::AutoRunner in test-unit gem

kou	2012-11-03 17:56:22 +0900 (Sat, 03 Nov 2012)

  New Revision: 37455

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

  Log:
    * bin/testrb: Use only Test::Unit::AutoRunner in test-unit gem
      compatible API to be available by both test/unit bundled in Ruby
      and test-unit gem.
    * lib/test/unit.rb (Test::Unit::AutoRunner): Move codes from testrb.

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37454)
+++ ChangeLog	(revision 37455)
@@ -1,3 +1,12 @@
+Sat Nov  3 17:55:07 2012  Kouhei Sutou  <kou@c...>
+
+Sat Nov  3 17:53:43 2012  Kouhei Sutou  <kou@c...>
+
+	* bin/testrb: Use only Test::Unit::AutoRunner in test-unit gem
+	  compatible API to be available by both test/unit bundled in Ruby
+	  and test-unit gem.
+	* lib/test/unit.rb (Test::Unit::AutoRunner): Move codes from testrb.
+
 Sat Nov  3 14:56:21 2012  Tadayoshi Funaba  <tadf@d...>
 
 	* ext/date/date_parse.c (parse_eu): should capture apostrophe too.
Index: lib/test/unit.rb
===================================================================
--- lib/test/unit.rb	(revision 37454)
+++ lib/test/unit.rb	(revision 37455)
@@ -804,6 +804,7 @@
       attr_accessor :to_run, :options
 
       def initialize(force_standalone = false, default_dir = nil, argv = ARGV)
+        @force_standalone = force_standalone
         @runner = Runner.new do |files, options|
           options[:base_directory] ||= default_dir
           files << default_dir if files.empty? and default_dir
@@ -813,6 +814,9 @@
         end
         Runner.runner = @runner
         @options = @runner.option_parser
+        if @force_standalone
+          @options.banner.sub!(/\[options\]/, '\& tests...')
+        end
         @argv = argv
       end
 
@@ -822,6 +826,9 @@
       end
 
       def run
+        if @force_standalone and not process_args(@argv)
+          abort @options.banner
+        end
         @runner.run(@argv) || true
       end
 
Index: bin/testrb
===================================================================
--- bin/testrb	(revision 37454)
+++ bin/testrb	(revision 37455)
@@ -1,10 +1,3 @@
 #!/usr/bin/env ruby
 require 'test/unit'
-tests = Test::Unit::AutoRunner.new(true)
-tests.options.banner.sub!(/\[options\]/, '\& tests...')
-unless tests.process_args(ARGV)
-  abort tests.options.banner
-end
-files = tests.to_run
-$0 = files.size == 1 ? File.basename(files[0]) : files.to_s
-exit tests.run
+exit Test::Unit::AutoRunner.run(true)

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

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