1284990Scy# ========================================== 2284990Scy# Unity Project - A Test Framework for C 3284990Scy# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4284990Scy# [Released under MIT License. Please refer to license.txt for details] 5284990Scy# ========================================== 6284990Scy 7284990Scyrequire "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" 8284990Scy 9284990Scy$colour_output = true 10284990Scy 11284990Scydef report(message) 12284990Scy if not $colour_output 13284990Scy $stdout.puts(message) 14284990Scy else 15284990Scy message = message.join('\n') if (message.class == Array) 16284990Scy message.each_line do |line| 17284990Scy line.chomp! 18284990Scy colour = case(line) 19284990Scy when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i 20284990Scy ($1.to_i == 0) ? :green : :red 21284990Scy when /PASS/ 22284990Scy :green 23284990Scy when /^OK$/ 24284990Scy :green 25284990Scy when /(?:FAIL|ERROR)/ 26284990Scy :red 27284990Scy when /IGNORE/ 28284990Scy :yellow 29284990Scy when /^(?:Creating|Compiling|Linking)/ 30284990Scy :white 31284990Scy else 32284990Scy :silver 33284990Scy end 34284990Scy colour_puts(colour, line) 35284990Scy end 36284990Scy end 37284990Scy $stdout.flush 38284990Scy $stderr.flush 39284990Scyend