lib/scan/test_result_parser.rb in scan-0.7.0 vs lib/scan/test_result_parser.rb in scan-0.7.1
- old
+ new
@@ -1,13 +1,13 @@
module Scan
class TestResultParser
def parse_result(output)
# e.g. ...<testsuites tests='2' failures='1'>...
- matched = output.match(%r{\<testsuites tests='(\d+)' failures='(\d+)'/?\>})
+ matched = output.scan(/<testsuites\b(?=[^<>]*\s+tests='(\d+)')(?=[^<>]*\s+failures='(\d+)')[^<>]+>/)
- if matched and matched.length == 3
- tests = matched[1].to_i
- failures = matched[2].to_i
+ if matched and matched.length == 1 and matched[0].length == 2
+ tests = matched[0][0].to_i
+ failures = matched[0][1].to_i
return {
tests: tests,
failures: failures
}