class UnitDiff
def diff expect, butwas
def diff expect, butwas output = nil Tempfile.open("expect") do |a| a.write(massage(expect)) a.rewind Tempfile.open("butwas") do |b| b.write(massage(butwas)) b.rewind diff_flags = $u ? "-u" : $c ? "-c" : "" diff_flags += " -b" if $b result = `#{DIFF} #{diff_flags} #{a.path} #{b.path}` output = if result.empty? then "[no difference--suspect ==]" else result.split(/\n/) end if $k then warn "moving #{a.path} to #{a.path}.keep" File.rename a.path, a.path + ".keep" warn "moving #{b.path} to #{b.path}.keep" File.rename b.path, b.path + ".keep" end end end output end