1nickt has asked for the wisdom of the Perl Monks concerning the following question:
Hi all,
I'm looking for techniques to provide debug output from a TODO test running with Test::More.
What I want to do is output an additional message when a TODO test starts passing, to remind me to take some action. I can get the message to print with diag() when running in verbose mode, but not otherwise.
Output under verbose:use Test::More tests => 2; TODO: { local $TODO = ' '; is(1,1,'Inside') and diag 'In'; } is(1,1,'Outside') and diag 'Out';
Output without verbose:$ prove -lrv foo.t foo.t .. 1..2 ok 1 - Inside # TODO # In ok 2 - Outside # Out ok All tests successful. Test Summary Report ------------------- foo.t (Wstat: 0 Tests: 2 Failed: 0) TODO passed: 1 Files=1, Tests=2, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.01 cusr + 0.00 csys = 0.03 CPU) Result: PASS
I know that Test::More clones STDOUT and STDERR and other black magic ... but is there any way to accomplish what I want?$ prove -lr foo.t foo.t .. 1/2 # Out foo.t .. ok All tests successful. Test Summary Report ------------------- foo.t (Wstat: 0 Tests: 2 Failed: 0) TODO passed: 1 Files=1, Tests=2, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.02 cusr + 0.00 csys = 0.04 CPU) Result: PASS
Thanks in advance!
Note:
Output without verbose:use Test::More tests => 3; is(1,1,'Outside') and diag 'Out'; TODO: { local $TODO = ' '; is(1,1,'Inside') and diag 'In'; } is(1,1,'Back Outside') and diag 'Out Again';
Output with verbose:$ prove -lr foo.t foo.t .. 1/3 # Out # Out Again foo.t .. ok All tests successful.
$ prove -lrv foo.t foo.t .. 1..3 ok 1 - Outside ok 2 - Inside # TODO # In ok 3 - Back Outside # Out # Out Again ok All tests successful.
|
|---|