mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test/unit: refine output in verbose mode
* test/lib/test/unit.rb (Test::Unit::StatusLine#_prepare_run): add StatusLine::Output even if job_status is not replace, to filter extra outputs and newlines. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fea80948c7
commit
9c55cb2e9e
1 changed files with 11 additions and 13 deletions
|
@ -522,30 +522,27 @@ module Test
|
||||||
|
|
||||||
def del_status_line(flush = true)
|
def del_status_line(flush = true)
|
||||||
@status_line_size ||= 0
|
@status_line_size ||= 0
|
||||||
unless @options[:job_status] == :replace
|
if @options[:job_status] == :replace
|
||||||
$stdout.puts
|
$stdout.print "\r"+" "*@status_line_size+"\r"
|
||||||
return
|
else
|
||||||
|
$stdout.puts if @status_line_size > 0
|
||||||
end
|
end
|
||||||
print "\r"+" "*@status_line_size+"\r"
|
|
||||||
$stdout.flush if flush
|
$stdout.flush if flush
|
||||||
@status_line_size = 0
|
@status_line_size = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_status(line, flush: true)
|
def add_status(line, flush: true)
|
||||||
unless @options[:job_status] == :replace
|
|
||||||
print(line)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
@status_line_size ||= 0
|
@status_line_size ||= 0
|
||||||
line = line[0...(terminal_width-@status_line_size)]
|
if @options[:job_status] == :replace
|
||||||
|
line = line[0...(terminal_width-@status_line_size)]
|
||||||
|
end
|
||||||
print line
|
print line
|
||||||
$stdout.flush if flush
|
$stdout.flush if flush
|
||||||
@status_line_size += line.size
|
@status_line_size += line.size
|
||||||
end
|
end
|
||||||
|
|
||||||
def jobs_status
|
def jobs_status
|
||||||
return unless @options[:job_status]
|
return if !@options[:job_status] or @options[:verbose]
|
||||||
puts "" unless @options[:verbose] or @options[:job_status] == :replace
|
|
||||||
status_line = @workers.map(&:to_s).join(" ")
|
status_line = @workers.map(&:to_s).join(" ")
|
||||||
update_status(status_line) or (puts; nil)
|
update_status(status_line) or (puts; nil)
|
||||||
end
|
end
|
||||||
|
@ -587,8 +584,8 @@ module Test
|
||||||
end
|
end
|
||||||
if color or @options[:job_status] == :replace
|
if color or @options[:job_status] == :replace
|
||||||
@verbose = !options[:parallel]
|
@verbose = !options[:parallel]
|
||||||
@output = Output.new(self)
|
|
||||||
end
|
end
|
||||||
|
@output = Output.new(self)
|
||||||
if /\A\/(.*)\/\z/ =~ (filter = options[:filter])
|
if /\A\/(.*)\/\z/ =~ (filter = options[:filter])
|
||||||
filter = Regexp.new($1)
|
filter = Regexp.new($1)
|
||||||
end
|
end
|
||||||
|
@ -604,12 +601,13 @@ module Test
|
||||||
|
|
||||||
def new_test(s)
|
def new_test(s)
|
||||||
@test_count += 1
|
@test_count += 1
|
||||||
|
return if !@options[:job_status] or @options[:verbose]
|
||||||
update_status(s)
|
update_status(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_status(s)
|
def update_status(s)
|
||||||
count = @test_count.to_s(10).rjust(@total_tests.size)
|
count = @test_count.to_s(10).rjust(@total_tests.size)
|
||||||
del_status_line(false) if @options[:job_status] == :replace
|
del_status_line(false)
|
||||||
print(@passed_color)
|
print(@passed_color)
|
||||||
add_status("[#{count}/#{@total_tests}]", flush: false)
|
add_status("[#{count}/#{@total_tests}]", flush: false)
|
||||||
print(@reset_color)
|
print(@reset_color)
|
||||||
|
|
Loading…
Add table
Reference in a new issue