> Override Test::Builder::ok to croak if it doesn't get a test name argument.
> Package that up in a module and shim it in with PERL5OPT or
> HARNESS_PERL_SWITCHES.
I kind of dislike this approach. If my tests are failing, I want them
to fail because my program is broken, not because my tests are broken.
I also don't want missing comments to stop my test from running...
sometimes you need to quickly fix something, run the tests, and *then*
make everything pretty.
So I would prefer that "t/style.t" fails due to "No description of test
on line 31 of frob.t", rather than t/frob.t failing (or croaking!) for
the same reason.
Unfortunately, this is sort of a only-perl-can-parse-Perl issue. You
don't know that you didn't have a description until you've run the test.
The best thing I can think of is to have the harness check for comments,
and report an error at the end if some were missing. Maybe it could
make up a test, so the output looks like:
-----
t/real.t.........ok
t/foo.t..........ok
t/tap_comments...23
# FAIL: t/foo.t test #42 needs a comment
...NOT OK
Failed 1/96 tests, 98.96% okay
Failed Test Stat Wstat Total Fail List of Failed
-------------------------------------------------------------------------------
tap_comments 48 1 23
Failed 1/1 test scripts. 1/96 subtests failed.
Files=2, Tests=96, 4 wallclock secs ( 0.11 cusr + 0.06 csys = 0.17 CPU)
Failed 1/3 test programs. 1/96 subtests failed.
-----
This has the added benefit of restricting this test to the developer --
it's unlikely that end-users of your module care about the TAP comments.
I think this would be pretty easy to implement, too.
Regards,
Jonathan Rockway
--
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;