diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-02 07:03:22 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-02 07:03:22 +0000 |
commit | 61b9074ca68baab4bc7f082af21ccd2ed43f42be (patch) | |
tree | 20f71834965efd355850929b6bcacd631819d1a6 /test | |
parent | a2845a44f82f23bd42cb5752f5f8cecdc88bf21b (diff) | |
download | ruby-61b9074ca68baab4bc7f082af21ccd2ed43f42be.tar.gz |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/test/unit.rb | 7 |
1 files 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 |