module Minitest::Assertions

def diff exp, act

def diff exp, act
  result = nil
  expect, butwas = things_to_diff(exp, act)
  return "Expected: #{mu_pp exp}\n  Actual: #{mu_pp act}" unless
    expect
  Tempfile.open("expect") do |a|
    a.puts expect
    a.flush
    Tempfile.open("butwas") do |b|
      b.puts butwas
      b.flush
      result = `#{Minitest::Assertions.diff} #{a.path} #{b.path}`
      result.sub!(/^\-\-\- .+/, "--- expected")
      result.sub!(/^\+\+\+ .+/, "+++ actual")
      if result.empty? then
        klass = exp.class
        result = [
                  "No visible difference in the #{klass}#inspect output.\n",
                  "You should look at the implementation of #== on ",
                  "#{klass} or its members.\n",
                  expect,
                 ].join
      end
    end
  end
  result
end