class UnitDiff

def unit_diff(input=ARGF, output=$stdout)

def unit_diff(input=ARGF, output=$stdout)
  $b = false unless defined? $b
  $c = false unless defined? $c
  $k = false unless defined? $k
  $u = false unless defined? $u
  data, footer = self.parse_input(input, output)
  output = []
  # Output
  data.each do |result|
    first = []
    second = []
    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?# unless footer.first.nil?
    output.push footer.compact.map {|line| line.strip}.join("\n")
  end
  return output.flatten.join("\n")
end