Sha256: e427c53bb8ce2b734cee8c9749d08de478f1159023ebacd464de036bd2ad66b1

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

# =========================================================================
#   Unity - A Test Framework for C
#   ThrowTheSwitch.org
#   Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
#   SPDX-License-Identifier: MIT
# =========================================================================

require_relative 'colour_prompt'

$colour_output = true

def report(message)
  if !$colour_output
    $stdout.puts(message)
  else
    message = message.join('\n') if message.instance_of?(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
                 Regexp.last_match(1).to_i.zero? ? :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

Version data entries

4 entries across 2 versions & 1 rubygems

Version Path
ceedling-1.0.1 vendor/cmock/vendor/unity/auto/colour_reporter.rb
ceedling-1.0.1 vendor/unity/auto/colour_reporter.rb
ceedling-1.0.0 vendor/cmock/vendor/unity/auto/colour_reporter.rb
ceedling-1.0.0 vendor/unity/auto/colour_reporter.rb