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

ruby-changes:41123

From: nobu <ko1@a...>
Date: Sat, 19 Dec 2015 10:18:05 +0900 (JST)
Subject: [ruby-changes:41123] nobu:r53196 (trunk): test/unit.rb: fix outputs

nobu	2015-12-19 10:17:41 +0900 (Sat, 19 Dec 2015)

  New Revision: 53196

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

  Log:
    test/unit.rb: fix outputs
    
    * test/lib/test/unit.rb (Test::Unit::StatusLine#update_status):
      do not print extra empty lines when running on non-tty.
      fix colorizing in verbose mode.

  Modified files:
    trunk/test/lib/test/unit.rb
Index: test/lib/test/unit.rb
===================================================================
--- test/lib/test/unit.rb	(revision 53195)
+++ test/lib/test/unit.rb	(revision 53196)
@@ -531,11 +531,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L531
         @status_line_size = 0
       end
 
-      def status_color(line)
-        print line if @options[:job_status] == :replace
-      end
-
-      def add_status(line)
+      def add_status(line, flush: true)
         unless @options[:job_status] == :replace
           print(line)
           return
@@ -543,7 +539,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L539
         @status_line_size ||= 0
         line = line[0...(terminal_width-@status_line_size)]
         print line
-        $stdout.flush
+        $stdout.flush if flush
         @status_line_size += line.size
       end
 
@@ -613,10 +609,10 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L609
 
       def update_status(s)
         count = @test_count.to_s(10).rjust(@total_tests.size)
-        del_status_line(false)
-        status_color(@passed_color)
-        add_status("[#{count}/#{@total_tests}]")
-        status_color(@reset_color)
+        del_status_line(false) if @options[:job_status] == :replace
+        print(@passed_color)
+        add_status("[#{count}/#{@total_tests}]", flush: false)
+        print(@reset_color)
         add_status(" #{s}")
       end
 

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

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