class Parser
Lifted from github.com/orta/Snapshots/blob/master/SnapshotDiffs/ORLogReader.m
Public Class Methods
new()
click to toggle source
# File lib/second_curtain/parser.rb, line 8 def initialize @test_suites = [] end
Public Instance Methods
extract_command_string_from_line(line)
click to toggle source
# File lib/second_curtain/parser.rb, line 42 def extract_command_string_from_line(line) return line.split("diff:\n").last end
failing_commands()
click to toggle source
# File lib/second_curtain/parser.rb, line 46 def failing_commands @test_suites.map { |e| e.test_cases }.flatten.map { |e| e.commands }.flatten.select { |e| e.fails } end
has_failing_commands()
click to toggle source
# File lib/second_curtain/parser.rb, line 50 def has_failing_commands failing_commands.count > 0 end
latest_test_suite()
click to toggle source
# File lib/second_curtain/parser.rb, line 38 def latest_test_suite @test_suites.last end
parse_line(line)
click to toggle source
# File lib/second_curtain/parser.rb, line 12 def parse_line(line) if line.include?("Test Suite") test_suite = TestSuite.suite_from_line(line) @test_suites.push test_suite unless test_suite == nil end if line.include?("Test Case") && latest_test_suite if line.include?("started.") test_case = XcodeTestCase.test_case_from_line(line) latest_test_suite.test_cases.push test_case unless test_case == nil elsif line.include?("' failed (") latest_test_suite.latest_test_case.commands.each do |command| command.fails = true end end end if line.include?("ksdiff") && latest_test_suite command_string = extract_command_string_from_line(line) command = KaleidoscopeCommand.command_from_line(command_string) if command != nil latest_test_suite.latest_test_case.add_command command end end end