On Wed, Aug 22, 2001 at 10:45:35PM +0100, Nicholas Clark wrote:
> There's a potentially useful feature of Test.pm missing from Test::Simple
> (and therefore Test::More)
> The second argument of ok() is a "diagnostic" rather than a "name"
> It's also allowed to be a code reference, which is run to get a string.
> This means it's possible to write a test like this
> 
> ok (seek (TEST, $sub_start, SEEK_SET), sub {"seek failed with \$!=$!"});
> 
> and get the value of $! from after the test failing printed as part of the
> output.
> 
> I can't see how to do this with Test::Simple.

This should work.

    ok( seek(TEST, $sub_start, SEEK_SET) ) || 
        print "# seek failed with $!\n";

I plan to add a print_comment() function to Test::More eventually, so
everything is nice and escaped.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
That which stirs me, stirs everything.
        -- Squonk Opera, "Spoon"

Reply via email to