Class: Mxrb::Functional::LogParser

Inherits:
Object
  • Object
show all
Defined in:
lib/mxrb/functional.rb

Constant Summary collapse

PATTERN =
/\[MXRB_TEST\] (PASS|FAIL) (.+)$/

Instance Method Summary collapse

Instance Method Details

#parse(text) ⇒ Object



258
259
260
261
262
263
264
265
266
267
# File 'lib/mxrb/functional.rb', line 258

def parse(text)
  tests = text.each_line.filter_map do |line|
    match = line.strip.match(PATTERN)
    next unless match

    passed = match[1] == "PASS"
    TestResult.new(match[2], passed, passed ? "passed" : "microflow failed")
  end
  Result.new(tests.freeze, text.include?("[MXRB_TEST] DONE"))
end