Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/cJSON/blob/master/tests/unity/auto/colour_reporter.rb # cJSON [Ported from github.com/DaveGamble/cJSON] Fix: heap-use-after-free in merge_patch when patch is subtree of target (#1065) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `cJSON / tests / unity / auto / colour_reporter.rb` 39 lines ยท 1178 bytes Raw Blame History 1 # ========================================== 2 # Unity Project - A Test Framework for C 3 # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams 4 # [Released under MIT License. Please refer to license.txt for details] 5 # ========================================== 6 7 require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt" 8 9 $colour_output = true 10 11 def report(message) 12 if !$colour_output 13 $stdout.puts(message) 14 else 15 message = message.join('\n') if message.class == Array 16 message.each_line do |line| 17 line.chomp! 18 colour = case line 19 when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i 20 Regexp.last_match(1).to_i.zero? ? :green : :red 21 when /PASS/ 22 :green 23 when /^OK$/ 24 :green 25 when /(?:FAIL|ERROR)/ 26 :red 27 when /IGNORE/ 28 :yellow 29 when /^(?:Creating|Compiling|Linking)/ 30 :white 31 else 32 :silver 33 end 34 colour_puts(colour, line) 35 end 36 end 37 $stdout.flush 38 $stderr.flush 39 end