def make_patch( expected, actual )
      diffs = Diff::LCS.sdiff( expected.split("\n"), actual.split("\n"),
        Diff::LCS::ContextDiffCallbacks )

      maxcol = diffs.flatten.
        collect {|d| [d.old_element.to_s.length, d.new_element.to_s.length ] }.
        flatten.max || 0
      maxcol += 4

      patch = "              %#{maxcol}s | %s\n" % [ "Expected", "Actual" ]
      patch << diffs.collect do |changeset|
        changeset.collect do |change|
          "%s [%03d, %03d]: %#{maxcol}s | %-#{maxcol}s" % [
            change.action,
            change.old_position,
            change.new_position,
            change.old_element.inspect,
            change.new_element.inspect,
          ]
        end.join("\n")
      end.join("\n---\n")
    end
def make_patch( expected, actual )
      diffs = Diff::LCS.sdiff( expected.split("\n"), actual.split("\n"),
        Diff::LCS::ContextDiffCallbacks )

      maxcol = diffs.flatten.
        collect {|d| [d.old_element.to_s.length, d.new_element.to_s.length ] }.
        flatten.max || 0
      maxcol += 4

      patch = "              %#{maxcol}s | %s\n" % [ "Expected", "Actual" ]
      patch << diffs.collect do |changeset|
        changeset.collect do |change|
          "%s [%03d, %03d]: %#{maxcol}s | %-#{maxcol}s" % [
            change.action,
            change.old_position,
            change.new_position,
            change.old_element.inspect,
            change.new_element.inspect,
          ]
        end.join("\n")
      end.join("\n---\n")
    end
Compute a patch between the given +expected+ output and the +actual+ output
 and return it as a string.