summaryrefslogtreecommitdiff
path: root/test/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-19 01:17:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-19 01:17:41 +0000
commit94d36ce335fb7044d71c11737f570f0b223427ce (patch)
treecbeea331af121ca8cf89380a54efeb4ea79773cd /test/lib
parentd660e06f2830af2a99c57746b2953a5638b959c1 (diff)
test/unit.rb: fix outputs
* test/lib/test/unit.rb (Test::Unit::StatusLine#update_status): do not print extra empty lines when running on non-tty. fix colorizing in verbose mode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/test/unit.rb16
1 files changed, 6 insertions, 10 deletions
diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb
index da0c50d..9c1100b 100644
--- a/test/lib/test/unit.rb
+++ b/test/lib/test/unit.rb
@@ -531,11 +531,7 @@ module Test
@status_line_size = 0
end
- def status_color(line)
- print line if @options[:job_status] == :replace
- end
-
- def add_status(line)
+ def add_status(line, flush: true)
unless @options[:job_status] == :replace
print(line)
return
@@ -543,7 +539,7 @@ module Test
@status_line_size ||= 0
line = line[0...(terminal_width-@status_line_size)]
print line
- $stdout.flush
+ $stdout.flush if flush
@status_line_size += line.size
end
@@ -613,10 +609,10 @@ module Test
def update_status(s)
count = @test_count.to_s(10).rjust(@total_tests.size)
- del_status_line(false)
- status_color(@passed_color)
- add_status("[#{count}/#{@total_tests}]")
- status_color(@reset_color)
+ del_status_line(false) if @options[:job_status] == :replace
+ print(@passed_color)
+ add_status("[#{count}/#{@total_tests}]", flush: false)
+ print(@reset_color)
add_status(" #{s}")
end