Fergal Daly wrote:
> [oops sending to the list this time]
> 
> 2009/3/13 Ovid <publiustemp-perl...@yahoo.com>:
>> ________________________________
>> From: Josh Heumann <perl...@joshheumann.com>
>>
>>> In that case, the way to generate well-formed TAP seems to be to put the
>>> END block above the use statement, which either means an end statement
>>> at the top in the section of the code with the use statements, or to put
>>> the use statement lower than the END block.
>>
>> That's awful, but I think this is a Perl limitation.  I should probably 
>> include this in the documentation.

Test::More's done_testing() has the same problem. :(

A stupid work around is to put "use Test::NoWarnings" after your END block.

Another is to use no_plan in the END block because it doesn't output until
inside Test::Builder's own END block.

$ perl -wle 'use Test::NoWarnings;  use Test::More;  pass("first");  END {
pass();  plan "no_plan"; }'
ok 1 - first
ok 2
ok 3 - no warnings
1..3

Another is to `require Test::NoWarnings; Test::NoWarnings->import;`


> If I have this straight, the problem is that T::NW's END executes
> after the test script's END. This happens because T:NW's END is
> compiled before the test script's END.
> 
> You could get around this by having Test:::Most require T::NW in a
> CHECK or INIT. This will cause T::NW's END to be compiled after
> everything else and so will run before all other END blocks.

That will work fine, and since Test::Most already loads a bunch of Test
modules one more wouldn't seem to hurt much.

Need to come up with a better way to deal with end-of-test-process tests.


-- 
Don't try the paranormal until you know what's normal.
    -- "Lords and Ladies" by Terry Prachett

Reply via email to