1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test: reduce unnecessary output

* lib/test/unit.rb (Test::Unit::Runner#del_status_line): update
  @status_line_size and return true value.

* lib/test/unit.rb (Test::Unit::Runner#{put,add,jobs}_status): return
  non-nil/false if status line is used.

* lib/test/unit.rb (Test::Unit::Runner#_run_parallel): clear status
  line at last.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-06-16 04:23:32 +00:00
parent 04a7aabfbf
commit de7eb55f7f

View file

@ -399,10 +399,14 @@ module Test
return unless @options[:job_status] == :replace return unless @options[:job_status] == :replace
print "\r"+" "*@status_line_size+"\r" print "\r"+" "*@status_line_size+"\r"
$stdout.flush $stdout.flush
@status_line_size = 0
end end
def put_status(line) def put_status(line)
return print(line) unless @options[:job_status] == :replace unless @options[:job_status] == :replace
print(line)
return
end
@status_line_size ||= 0 @status_line_size ||= 0
del_status_line del_status_line
$stdout.flush $stdout.flush
@ -413,7 +417,10 @@ module Test
end end
def add_status(line) def add_status(line)
return print(line) unless @options[:job_status] == :replace 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)] line = line[0...(terminal_width-@status_line_size)]
print line print line
@ -425,11 +432,7 @@ module Test
return unless @options[:job_status] return unless @options[:job_status]
puts "" unless @options[:verbose] or @options[:job_status] == :replace puts "" unless @options[:verbose] or @options[:job_status] == :replace
status_line = @workers.map(&:to_s).join(" ") status_line = @workers.map(&:to_s).join(" ")
if @options[:job_status] == :replace put_status status_line or (puts; nil)
put_status status_line
else
puts status_line
end
end end
def del_jobs_status def del_jobs_status
@ -607,7 +610,7 @@ module Test
suites, rep = rep.partition {|r| r[:testcase] && r[:file] && !r[:report].empty?} suites, rep = rep.partition {|r| r[:testcase] && r[:file] && !r[:report].empty?}
suites.map {|r| r[:file]}.uniq.each {|file| require file} suites.map {|r| r[:file]}.uniq.each {|file| require file}
suites.map! {|r| eval("::"+r[:testcase])} suites.map! {|r| eval("::"+r[:testcase])}
puts "" del_status_line or puts
puts "Retrying..." puts "Retrying..."
puts "" puts ""
_run_suites(suites, type) _run_suites(suites, type)