summaryrefslogtreecommitdiff
path: root/test/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-18 15:06:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-18 15:06:00 +0000
commit2a2010c5c19c2cbd17404144832ca0f52cf2cf73 (patch)
tree66abee35c720bdaa089f10433ca282eaae4641cc /test/lib
parent0967c1e3ad0fb8d36e0b4fe4117f8e6faca3e9f0 (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/test/unit.rb24
1 files changed, 9 insertions, 15 deletions
diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb
index 85e6d76..da0c50d 100644
--- a/test/lib/test/unit.rb
+++ b/test/lib/test/unit.rb
@@ -520,29 +520,19 @@ module Test
@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
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