parse_input (lib/unit_diff.rb)

    # File lib/unit_diff.rb, line 59
      def parse_input(input, output)
        current = []
        data = []
        data << current
        print_lines = true

        term = "\nFinished".split(//).map { |c| c[0] }
        term_length = term.size

        old_sync = output.sync
        output.sync = true
        while line = input.gets
          case line
          when /^(Loaded suite|Started)/ then
            print_lines = true
            output.puts line
            chars = []
            while c = input.getc do
              output.putc c
              chars << c
              tail = chars[-term_length..-1]
              break if chars.size >= term_length and tail == term
            end
            output.puts input.gets # the rest of "Finished in..."
            output.puts
           next
          when /^\s*$/, /^\(?\s*\d+\) (Failure|Error):/, /^\d+\)/ then
            print_lines = false
            current = []
            data << current
          when /^Finished in \d/ then
            print_lines = false
          end
          output.puts line if print_lines
          current << line
        end
        output.sync = old_sync
        data = data.reject { |o| o == ["\n"] or o.empty? }
        footer = data.pop

        return data, footer
      end