Add diag_log method and auto_diag option #68

Open
wants to merge 4 commits into
from

Conversation

Projects
None yet
3 participants
Contributor

madsen commented Nov 3, 2011

I was thinking that something like diag_log ought to be in core. I came up with a nicer way of doing it. You just add auto_diag => 1 to the tester parameters when creating your $tzil object. That causes it to record the current number of failed tests. When $tzil is destroyed, if there have been additional test failures, it writes out the log messages.

$tzil->diag_log passes the log entries to Test::Builder's diag()

auto_diag => 1 does that automatically if any tests fail between construction and destruction

Owner

rjbs commented Dec 13, 2011

I have only given this a cursory look, but the first problem I see is that a DEMOLISH sub is added to a role. In general, roles must not have BUILD or DEMOLISH methods, as it will lead to conflicts and potentially ordering issues.

I know it will work now, but I'd rather not go this route if possible.

I'll try to give it more looking in the future and see if I can suggest an alternate route.

Contributor

madsen commented Dec 13, 2011

How about using a before modifier on DESTROY? That seems to work the same. We're not actually destroying anything; it just needs to run at object destruction time.

madsen added some commits Nov 3, 2011

@madsen madsen Add diag_log method and auto_diag option
$tzil->diag_log passes the log entries to Test::Builder's diag()

auto_diag => 1 does that automatically if any tests fail between
construction and destruction
d770a00
@madsen madsen Use auto_diag in distmeta.t & pkgversion.t 29ec187
@madsen madsen Mention diag_log & auto_log in Changes 2e04c4c
@madsen madsen Use before DESTROY instead of using DEMOLISH in a role 7d295ff
Contributor

karenetheridge commented Mar 17, 2013

This should be rebased against master and re-reviewed for sanity.

rjbs added the Needs Rebase label Jul 25, 2015

Owner

rjbs commented Jul 25, 2015

I will apply this if rebased.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment