Bug#419637: [rt.cpan.org #32330] things using Test::Deep::NoTest are untestable with Test::Deep

Damyan Ivanov dmn at debian.org
Sat Oct 4 16:21:48 UTC 2008


Thank you Michhael for your reply.

I am forwarding it to the bug submitter (CC-ing also the bug itself to 
keep the log).

Alexander, can you check if the approach below is feasibble? It would 
also be good if you can reply to Fergal's mail[1]

    [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=419637#14


-=| Michael G Schwern via RT, Sat, Oct 04, 2008 at 01:28:30AM -0400 |=-
> <URL: http://rt.cpan.org/Ticket/Display.html?id=32330 >
> 
> I was looking at $Test::Deep::NoTest today and it occurs to me that
> rather than undefining $Test you could instead use a mock Test::Builder
> object that does nothing except ok() but silently.  Everything else is a
> no-op (throw in an AUTOLOAD).  That would at least make things like
> cmp_deeply() work without having to do any special checks.
> 
> As for avoiding Test::Deep::NoTest from stomping on $Test... you could
> make use of the new lexical pragma stuff in 5.10.  mjd might have
> backported that.  Another trick would be to use a local variable to
> switch.  $Test would be a proxy object between the real and mock
> Test::Builders.  It has an AUTOLOAD which simply looks at the flag and
> decides which to call.
> 
> if( $NoTest ) {
>     $mock->$method(@args);
> }
> else {
>     $real->$metho(@args);
> }
> 
> 

-- 
dam            JabberID: dam at jabber.minus273.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20081004/fc33cef5/attachment.pgp 


More information about the pkg-perl-maintainers mailing list