304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
# File 'lib/assert/assertions.rb', line 304
def assert_same(exp, act, desc = nil)
assert(act.equal?(exp), desc) do
c = __assert_config__
exp_show = Assert::U.show_for_diff(exp, c)
act_show = Assert::U.show_for_diff(act, c)
exp_id = "#<#{exp.class}:#{"0x0%x" % (exp.object_id << 1)}>"
act_id = "#<#{act.class}:#{"0x0%x" % (act.object_id << 1)}>"
if c.use_diff_proc.call(exp_show, act_show)
"Expected #{act_id} to be the same as #{exp_id}, diff:\n"\
"#{c.run_diff_proc.call(exp_show, act_show)}"
else
"Expected #{Assert::U.show(act, c)} (#{act_id}) to "\
"be the same as #{Assert::U.show(exp, c)} (#{exp_id})."
end
end
end
|