Sha256: 1f10d2a75eac9c901d669645d1702f5fe098a3f037c263325357690daa1d8bac

Contents?: true

Size: 521 Bytes

Versions: 3

Compression:

Stored size: 521 Bytes

Contents

module Scan
  class TestResultParser
    def parse_result(output)
      # e.g. ...<testsuites tests='2' failures='1'>...
      matched = output.match(%r{\<testsuites tests='(\d+)' failures='(\d+)'/?\>})

      if matched and matched.length == 3
        tests = matched[1].to_i
        failures = matched[2].to_i

        return {
          tests: tests,
          failures: failures
        }
      else
        UI.error("Couldn't parse the number of tests from the output")
        return {}
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scan-0.7.0 lib/scan/test_result_parser.rb
scan-0.6.1 lib/scan/test_result_parser.rb
scan-0.6.0 lib/scan/test_result_parser.rb