mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-03 17:55:16 +08:00
adds output=colorized option
This commit is contained in:
@@ -155,6 +155,41 @@ module Bacon
|
||||
end
|
||||
end
|
||||
|
||||
module ColorizedOutput
|
||||
GREEN = "\033[0;32m"
|
||||
RED = "\033[0;31m"
|
||||
RESET = "\033[00m"
|
||||
|
||||
def handle_specification_begin(name); end
|
||||
def handle_specification_end ; end
|
||||
|
||||
def handle_requirement_begin(description) end
|
||||
def handle_requirement_end(error)
|
||||
if error.empty?
|
||||
print "#{GREEN}.#{RESET}"
|
||||
else
|
||||
print "#{RED}#{error[0..0]}#{RESET}"
|
||||
end
|
||||
end
|
||||
|
||||
def handle_summary
|
||||
puts ""
|
||||
puts "", ErrorLog if Backtraces && ! ErrorLog.empty?
|
||||
|
||||
duration = "%0.2f" % (Time.now - @timer)
|
||||
puts "", "Finished in #{duration} seconds."
|
||||
|
||||
color = GREEN
|
||||
if Counter[:errors] > 0 || Counter[:failed] > 0
|
||||
color = RED
|
||||
end
|
||||
|
||||
puts "#{color}%d tests, %d assertions, %d failures, %d errors#{RESET}" %
|
||||
Counter.values_at(:specifications, :requirements, :failed, :errors)
|
||||
puts ""
|
||||
end
|
||||
end
|
||||
|
||||
module FastOutput
|
||||
def handle_specification_begin(name); end
|
||||
def handle_specification_end; end
|
||||
@@ -238,6 +273,7 @@ module Bacon
|
||||
'tap' => TapOutput,
|
||||
'knock' => KnockOutput,
|
||||
'rubymine' => RubyMineOutput
|
||||
'colorized' => ColorizedOutput
|
||||
}
|
||||
extend(Outputs[ENV['output']] || SpecDoxOutput)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user