ruby-changes:41908
From: nobu <ko1@a...>
Date: Wed, 2 Mar 2016 16:03:27 +0900 (JST)
Subject: [ruby-changes:41908] nobu:r53982 (trunk): test/unit: return the cursor
nobu 2016-03-02 16:03:22 +0900 (Wed, 02 Mar 2016) New Revision: 53982 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53982 Log: test/unit: return the cursor * test/lib/test/unit.rb (update_status): keep the cursor to the beginning of the line for each update, so that unexpected output like an error message will overwrite but not be concatenated to the status. Modified files: trunk/test/lib/test/unit.rb Index: test/lib/test/unit.rb =================================================================== --- test/lib/test/unit.rb (revision 53981) +++ test/lib/test/unit.rb (revision 53982) @@ -536,13 +536,12 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L536 @status_line_size = 0 end - def add_status(line, flush: true) + def add_status(line) @status_line_size ||= 0 if @options[:job_status] == :replace line = line[0...(terminal_width-@status_line_size)] end print line - $stdout.flush if flush @status_line_size += line.size end @@ -617,9 +616,11 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L616 count = @test_count.to_s(10).rjust(@total_tests.size) del_status_line(false) print(@passed_color) - add_status("[#{count}/#{@total_tests}]", flush: false) + add_status("[#{count}/#{@total_tests}]") print(@reset_color) add_status(" #{s}") + $stdout.print "\r" if @options[:job_status] == :replace + $stdout.flush end def _print(s); $stdout.print(s); end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/