lib/xcpretty/parser.rb in xcpretty-0.2.2 vs lib/xcpretty/parser.rb in xcpretty-0.2.3

- old
+ new

@@ -5,11 +5,11 @@ module Matchers # @regex Captured groups # $1 file_path # $2 file_name - ANALYZE_MATCHER = /^Analyze(?:Shallow)?\s(.*\/(.*\.m))*/ + ANALYZE_MATCHER = /^Analyze(?:Shallow)?\s(.*\/(.*\.(?:m|mm|cc|cpp|c|cxx)))\s*/ # @regex Captured groups # $1 target # $2 project # $3 configuration @@ -17,10 +17,16 @@ # @regex Captured groups # $1 target # $2 project # $3 configuration + AGGREGATE_TARGET_MATCHER = /^=== BUILD AGGREGATE TARGET\s(.*)\sOF PROJECT\s(.*)\sWITH.*CONFIGURATION\s(.*)\s===/ + + # @regex Captured groups + # $1 target + # $2 project + # $3 configuration ANALYZE_TARGET_MATCHER = /^=== ANALYZE TARGET\s(.*)\sOF PROJECT\s(.*)\sWITH.*CONFIGURATION\s(.*)\s===/ # @regex Nothing returned here for now CHECK_DEPENDENCIES_MATCHER = /^Check dependencies/ @@ -90,13 +96,18 @@ # @regex Captured groups # $1 = file # $2 = test_suite # $3 = test_case # $4 = reason - FAILING_TEST_MATCHER = /^\s*(.+:\d+):\serror:\s[\+\-]\[(.*)\s(.*)\]\s:(?:\s'.*'\s\[FAILED\],)?\s(.*)/ + TEST_FAILURE_MATCHER = /^\s*(.+:\d+):\serror:\s[\+\-]\[(.*)\s(.*)\]\s:(?:\s'.*'\s\[FAILED\],)?\s(.*)/ # @regex Captured groups + # $1 = file + # $2 = reason + TEST_UI_FAILURE_MATCHER = /Assertion\sFailure:\s(.+:\d+):\s(.*)/ + + # @regex Captured groups # $1 = dsym GENERATE_DSYM_MATCHER = /^GenerateDSYMFile \/.*\/(.*\.dSYM)/ # @regex Captured groups # $1 = library @@ -104,16 +115,22 @@ # @regex Captured groups # $1 = target # $2 = build_variants (normal, profile, debug) # $3 = architecture - LINKING_MATCHER = /^Ld \/.*\/(.*) (.*) (.*)$/ + LINKING_MATCHER = /^Ld \/?.*\/(.*?) (.*) (.*)$/ # @regex Captured groups # $1 = suite # $2 = test_case # $3 = time + FAILING_TEST_MATCHER = /^\s*Test Case\s'-\[(.*)\s(.*)\]'\sfailed\s\((\d*\.\d{3})\sseconds\)/ + + # @regex Captured groups + # $1 = suite + # $2 = test_case + # $3 = time PASSING_TEST_MATCHER = /^\s*Test Case\s'-\[(.*)\s(.*)\]'\spassed\s\((\d*\.\d{3})\sseconds\)/ # @regex Captured groups # $1 = suite # $2 = test_case @@ -279,10 +296,12 @@ case text when ANALYZE_MATCHER formatter.format_analyze($2, $1) when BUILD_TARGET_MATCHER formatter.format_build_target($1, $2, $3) + when AGGREGATE_TARGET_MATCHER + formatter.format_aggregate_target($1, $2, $3) when ANALYZE_TARGET_MATCHER formatter.format_analyze_target($1, $2, $3) when CLEAN_REMOVE_MATCHER formatter.format_clean_remove when CLEAN_TARGET_MATCHER @@ -313,11 +332,11 @@ formatter.format_copy_plist_file($1, $2) when CPRESOURCE_MATCHER formatter.format_cpresource($1) when EXECUTED_MATCHER format_summary_if_needed(text) - when FAILING_TEST_MATCHER + when TEST_FAILURE_MATCHER formatter.format_failing_test($2, $3, $4, $1) when FATAL_ERROR_MATCHER formatter.format_error($1) when FILE_MISSING_ERROR_MATCHER formatter.format_file_missing_error($1, $2) @@ -333,10 +352,16 @@ formatter.format_linking($1, $2, $3) when MEASURING_TEST_MATCHER formatter.format_measuring_test($1, $2, $3) when PENDING_TEST_MATCHER formatter.format_pending_test($1, $2) + when FAILING_TEST_MATCHER + if @current_assertion_failure + formatter.format_failing_test($1, $2, @current_assertion_failure[:reason], @current_assertion_failure[:file]) + else + formatter.format_failing_test($1, $2, '', '') + end when PASSING_TEST_MATCHER formatter.format_passing_test($1, $2, $3) when PODS_ERROR_MATCHER formatter.format_error($1) when PROCESS_INFO_PLIST_MATCHER @@ -382,13 +407,26 @@ case text when TESTS_RUN_START_MATCHER @tests_done = false @formatted_summary = false @failures = {} + @assertion_failure = [] + @current_assertion_failure = {} when TESTS_RUN_COMPLETION_MATCHER @tests_done = true + when TEST_UI_FAILURE_MATCHER + @current_assertion_failure = { + file: $1, + reason: $2 + } when FAILING_TEST_MATCHER + if @current_assertion_failure + store_failure(@current_assertion_failure[:file], $1, $2, @current_assertion_failure[:reason]) + else + store_failure(nil, $1, $2, '') + end + when TEST_FAILURE_MATCHER store_failure($1, $2, $3, $4) end end # @ return Hash { :file_name, :file_path, :reason, :line } @@ -533,6 +571,5 @@ escaped_values.map { |v| v.delete('\\') } end end end -