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

ruby-changes:41120

From: nobu <ko1@a...>
Date: Sat, 19 Dec 2015 00:06:18 +0900 (JST)
Subject: [ruby-changes:41120] nobu:r53193 (trunk): test/unit.rb: use full columns

nobu	2015-12-19 00:06:00 +0900 (Sat, 19 Dec 2015)

  New Revision: 53193

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

  Log:
    test/unit.rb: use full columns
    
    * test/lib/test/unit.rb (Test::Unit::StatusLine#update_status):
      exclude colorizing escape sequences from @status_line_size to
      use full columns.

  Modified files:
    trunk/test/lib/test/unit.rb
Index: test/lib/test/unit.rb
===================================================================
--- test/lib/test/unit.rb	(revision 53192)
+++ test/lib/test/unit.rb	(revision 53193)
@@ -520,29 +520,19 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L520
         @terminal_width
       end
 
-      def del_status_line
+      def del_status_line(flush = true)
         @status_line_size ||= 0
         unless @options[:job_status] == :replace
           $stdout.puts
           return
         end
         print "\r"+" "*@status_line_size+"\r"
-        $stdout.flush
+        $stdout.flush if flush
         @status_line_size = 0
       end
 
-      def put_status(line)
-        unless @options[:job_status] == :replace
-          print(line)
-          return
-        end
-        @status_line_size ||= 0
-        del_status_line
-        $stdout.flush
-        line = line[0...terminal_width]
-        print line
-        $stdout.flush
-        @status_line_size = line.size
+      def status_color(line)
+        print line if @options[:job_status] == :replace
       end
 
       def add_status(line)
@@ -623,7 +613,11 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L613
 
       def update_status(s)
         count = @test_count.to_s(10).rjust(@total_tests.size)
-        put_status("#{@passed_color}[#{count}/#{@total_tests}]#{@reset_color} #{s}")
+        del_status_line(false)
+        status_color(@passed_color)
+        add_status("[#{count}/#{@total_tests}]")
+        status_color(@reset_color)
+        add_status(" #{s}")
       end
 
       def _print(s); $stdout.print(s); end

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

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