From 61b9074ca68baab4bc7f082af21ccd2ed43f42be Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 2 Mar 2016 07:03:22 +0000 Subject: 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/lib/test/unit.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb index d7163b2883..6775c3691a 100644 --- a/test/lib/test/unit.rb +++ b/test/lib/test/unit.rb @@ -536,13 +536,12 @@ module Test @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 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 -- cgit v1.2.3