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

ruby-changes:23524

From: nobu <ko1@a...>
Date: Tue, 8 May 2012 03:53:51 +0900 (JST)
Subject: [ruby-changes:23524] nobu:r35575 (trunk): bootstraptest/runner.rb: refine output

nobu	2012-05-08 03:53:42 +0900 (Tue, 08 May 2012)

  New Revision: 35575

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

  Log:
    bootstraptest/runner.rb: refine output
    
    * bootstraptest/runner.rb (exec_test, show_progress): show rotators
      and pass/fail counts.

  Modified files:
    trunk/ChangeLog
    trunk/bootstraptest/runner.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35574)
+++ ChangeLog	(revision 35575)
@@ -1,5 +1,8 @@
-Tue May  8 03:51:19 2012  Nobuyoshi Nakada  <nobu@r...>
+Tue May  8 03:53:40 2012  Nobuyoshi Nakada  <nobu@r...>
 
+	* bootstraptest/runner.rb (exec_test, show_progress): show rotators
+	  and pass/fail counts.
+
 	* sample/test.rb (PROGRESS): refine output.
 
 Tue May  8 02:34:26 2012  NARUSE, Yui  <naruse@r...>
Index: bootstraptest/runner.rb
===================================================================
--- bootstraptest/runner.rb	(revision 35574)
+++ bootstraptest/runner.rb	(revision 35575)
@@ -110,6 +110,16 @@
   tests = Dir.glob("#{File.dirname($0)}/test_*.rb").sort if tests.empty?
   pathes = tests.map {|path| File.expand_path(path) }
 
+  @progress = %w[- \\ | /]
+  @progress_bs = "\b" * @progress[0].size
+  @tty = !@verbose && $stderr.tty?
+  if @tty and /mswin|mingw/ !~ RUBY_PLATFORM and /dumb/ !~ ENV["TERM"]
+    @passed = "\e[32m"
+    @failed = "\e[31m"
+    @reset = "\e[m"
+  else
+    @passed = @failed = @reset = ""
+  end
   unless quiet
     puts Time.now
     if defined?(RUBY_DESCRIPTION)
@@ -136,8 +146,18 @@
   @location = nil
   pathes.each do |path|
     $stderr.print "\n#{File.basename(path)} "
+    $stderr.print @progress[@count % @progress.size] if @tty
     $stderr.puts if @verbose
+    count = @count
+    error = @error
     load File.expand_path(path)
+    if @tty
+      if @error == error
+        $stderr.print "#{@progress_bs}#{@passed}PASS #{@count-count}#{@reset}"
+      else
+        $stderr.print "#{@progress_bs}#{@failed}FAIL #{@error-error}/#{@count-count}#{@reset}"
+      end
+    end
   end
   $stderr.puts
   if @error == 0
@@ -162,7 +182,11 @@
   end
   faildesc = yield
   if !faildesc
-    $stderr.print '.'
+    if @tty
+      $stderr.print "#{@progress_bs}#{@progress[@count % @progress.size]}"
+    else
+      $stderr.print '.'
+    end
     $stderr.puts if @verbose
   else
     $stderr.print 'F'

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

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