ruby-changes:24059
From: nobu <ko1@a...>
Date: Sat, 16 Jun 2012 13:23:43 +0900 (JST)
Subject: [ruby-changes:24059] nobu:r36110 (trunk): test: reduce unnecessary output
nobu 2012-06-16 13:23:32 +0900 (Sat, 16 Jun 2012) New Revision: 36110 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36110 Log: 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. Modified files: trunk/lib/test/unit.rb Index: lib/test/unit.rb =================================================================== --- lib/test/unit.rb (revision 36109) +++ lib/test/unit.rb (revision 36110) @@ -399,10 +399,14 @@ return unless @options[:job_status] == :replace print "\r"+" "*@status_line_size+"\r" $stdout.flush + @status_line_size = 0 end 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 del_status_line $stdout.flush @@ -413,7 +417,10 @@ end 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 line = line[0...(terminal_width-@status_line_size)] print line @@ -425,11 +432,7 @@ return unless @options[:job_status] puts "" unless @options[:verbose] or @options[:job_status] == :replace status_line = @workers.map(&:to_s).join(" ") - if @options[:job_status] == :replace - put_status status_line - else - puts status_line - end + put_status status_line or (puts; nil) end def del_jobs_status @@ -607,7 +610,7 @@ 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| eval("::"+r[:testcase])} - puts "" + del_status_line or puts puts "Retrying..." puts "" _run_suites(suites, type) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/