class Pronto::Rustcov

def parse_lcov(path)

def parse_lcov(path)
  uncovered = Hash.new { |h, k| h[k] = [] }
  file = nil
  begin
    File.foreach(path) do |line|
      case line
      when /^SF:(.+)/
        file = File.expand_path($1.strip)
      when /^DA:(\d+),0$/
        uncovered[file] << $1.to_i if file
      when /^end_of_record/
        file = nil
      end
    end
  rescue Errno::ENOENT
    # File not found, raise a more informative error
    fail "LCOV file not found at #{path}. Make sure your Rust tests were run with coverage enabled."
  end
  uncovered
end