1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Added just working Test::Unit::CoreAssertions#diff

This is not "diff", but show expected and actual results both,
just to get rid of `NoMethodError` when an assertion failed.
This commit is contained in:
Nobuyoshi Nakada 2020-07-16 17:38:58 +09:00 committed by Hiroshi SHIBATA
parent d52dffd817
commit 9fbbbadc96
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2

View file

@ -635,6 +635,22 @@ eom
super
end
end
def diff(exp, act)
require 'pp'
q = PP.new(+"")
q.guard_inspect_key do
q.group(2, "expected: ") do
q.pp exp
end
q.text q.newline
q.group(2, "actual: ") do
q.pp act
end
q.flush
end
q.output
end
end
end
end