Skip to content

Instantly share code, notes, and snippets.

@brianjriddle
Last active December 13, 2015 19:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianjriddle/4966605 to your computer and use it in GitHub Desktop.
Save brianjriddle/4966605 to your computer and use it in GitHub Desktop.
filter to get sane output from ocunit & kiwi tests when building xcode apps from the command line
#!/usr/bin/env ruby
$stdout.sync = true
@failed_tests = []
@success = true
@executed = ""
def green(s)
"\e[1;32m#{s}\e[0m"
end
def red(s)
"\e[1;31m#{s}\e[0m"
end
def orange(s)
"\e[1;33m#{s}\e[0m"
end
def filter(line)
output = ""
case line
when /Test Case '-.*' passed (.*)\./
#output = "\e[1;32m.\e[0m"
output = green "."
when /\[FAILED\]/
output = red "F"
@failed_tests << line
@success = false
when /^Executed /
@executed = line.chomp
end
output
end
ARGF.each do |line|
print filter line
end
puts
@failed_tests.each do |line|
puts line
end
puts orange @executed
if @success
puts green "** BUILD SUCCEEDED **"
else
puts red "** BUILD FAILED **"
exit 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment