mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-23 00:15:58 +01:00
- tweaked reporting colors git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@66 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
33 lines
718 B
Ruby
33 lines
718 B
Ruby
|
|
require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt"
|
|
|
|
$colour_output = true
|
|
|
|
def report(message)
|
|
if not $colour_output
|
|
$stdout.puts(message)
|
|
else
|
|
message.each_line do |line|
|
|
line.chomp!
|
|
colour = case(line)
|
|
when /Tests\s+(\d+)\s+Failures\s+\d+\s+Ignored/
|
|
($1.to_i == 0) ? :green : :red
|
|
when /PASS/
|
|
:green
|
|
when /^OK$/
|
|
:green
|
|
when /(?:FAIL|ERROR)/
|
|
:red
|
|
when /IGNORE/
|
|
:yellow
|
|
when /^(?:Creating|Compiling|Linking)/
|
|
:white
|
|
else
|
|
:blue
|
|
end
|
|
colour_puts(colour, line)
|
|
end
|
|
end
|
|
$stdout.flush
|
|
$stderr.flush
|
|
end |