# File lib/unit_diff.rb, line 192
  def unit_diff(input=ARGF, output=$stdout)
    $b = false unless defined? $b
    $c = false unless defined? $c
    $k = false unless defined? $k
    $u = true  unless defined? $u
    $p = false unless defined? $p

    data, footer = self.parse_input(input, output)

    output = []

    # Output
    data.each do |result|
      if result.first =~ /Error/ then
        output.push result.join('')
        next
      end

      prefix, expect, butwas, result_footer = parse_diff(result)

      output.push prefix.compact.map {|line| line.strip}.join("\n")

      if butwas then
        output.push self.diff(expect, butwas)

        output.push result_footer
        output.push ''
      else
        output.push expect.join('')
      end
    end

    if footer then
      footer.shift if footer.first.strip.empty?
      output.push footer.compact.map {|line| line.strip}.join("\n")
    end

    return output.flatten.join("\n")
  end