lib/xcpretty/printer.rb in xcpretty-0.0.2 vs lib/xcpretty/printer.rb in xcpretty-0.0.3
- old
+ new
@@ -1,18 +1,18 @@
require "paint"
module XCPretty
- module Printer
+ module Printer
- attr_accessor :colorize
+ attr_accessor :colorize
# @regex Captured groups
# $1 = file
# $2 = test_case
# $3 = failure_message
- FAILING_TEST_MATCHER = /(.+:\d+):\serror:\s[\+\-]\[(.*)\]\s:(?:\s'.*'\s\[FAILED\],)?\s(.*)/
+ FAILING_TEST_MATCHER = /(.+:\d+):\serror:\s[\+\-]\[(.*)\]\s:(?:\s'.*'\s\[FAILED\],)?\s(.*)/
# @regex Captured groups
# $1 = test_case
# $2 = time
PASSING_TEST_MATCHER = /Test Case\s'-\[(.*)\]'\spassed\s\((\d*\.\d{3})\sseconds\)/
@@ -21,20 +21,20 @@
# @regex Captured groups
# $1 test suite name
TESTS_START_MATCHER = /Test Suite ('.*(\.(o|x)ctest(.*))?') started at/
EXECUTED_MATCHER = /^Executed/
- Paint::SHORTCUTS[:printer] = {
- :white => Paint.color(:bold),
+ Paint::SHORTCUTS[:printer] = {
+ :white => Paint.color(:bold),
:red => Paint.color(:red),
:green => Paint.color(:green, :bright),
:link => Paint.color(:cyan),
}
- include Paint::Printer
+ include Paint::Printer
- def pretty_print(text)
+ def pretty_print(text)
update_test_state(text)
formatted_text = pretty_format(text)
formatted_text = format_test_summary(text) if formatted_text.empty?
STDOUT.print(formatted_text + optional_newline) unless formatted_text.empty?
@@ -79,30 +79,30 @@
reason = colorize? ? red(f[:failure_message]) : f[:failure_message]
path = colorize? ? link(f[:file]) : f[:file]
"#{f[:test_case]}, #{reason}\n#{path}"
end.join("\n\n")
final_message = if colorize?
- failures.any? ? red(executed_message) : green(executed_message)
- else
- executed_message
- end
+ failures.any? ? red(executed_message) : green(executed_message)
+ else
+ executed_message
+ end
text = [formatted_failures, final_message].join("\n\n\n").strip
"\n\n#{text}"
end
def failures
@failures ||= []
end
- def store_failure(file, test_case, failure_message)
+ def store_failure(file, test_case, failure_message)
failures << {
- file: file,
- test_case: test_case,
- failure_message: failure_message
+ :file => file,
+ :test_case => test_case,
+ :failure_message => failure_message
}
end
def colorize?
- !!@colorize
+ !!@colorize
end
- end
+ end
end