Ram Gandikota
/
IOTMetronome
FRDM K64F Metronome
Diff: pal/Test/Unity/auto/colour_reporter.rb
- Revision:
- 0:dbad57390bd1
diff -r 000000000000 -r dbad57390bd1 pal/Test/Unity/auto/colour_reporter.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pal/Test/Unity/auto/colour_reporter.rb Sun May 14 18:37:05 2017 +0000 @@ -0,0 +1,39 @@ +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams +# [Released under MIT License. Please refer to license.txt for details] +# ========================================== + +require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" + +$colour_output = true + +def report(message) + if not $colour_output + $stdout.puts(message) + else + message = message.join('\n') if (message.class == Array) + message.each_line do |line| + line.chomp! + colour = case(line) + when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i + ($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 + :silver + end + colour_puts(colour, line) + end + end + $stdout.flush + $stderr.flush +end \ No newline at end of file