Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Can I use Test::Differences with Test::LectroTest?

by tmoertel (Chaplain)
on Feb 02, 2005 at 16:46 UTC ( [id://427320]=note: print w/replies, xml ) Need Help??


in reply to Can I use Test::Differences with Test::LectroTest?

The problem is that ok() is tied to the Test::Builder testing and reporting harness and LectroTest uses a different underlying harness because of all the trials it does. (Maybe I should investigate integration?)

Anyway, if you want to use Test::Builder-based modules for their testing features and not for their harness features (which is the case when you are using them inside of LectroTest properties), you can (hackishly) redefine Test::Builder's ok() method to simply return the result status without doing anything else.

Using Test::More for the example:

use warnings; use strict; use Test::More; use Test::LectroTest; { no warnings; sub Test::Builder::ok { $_[1] ? 1 : 0 } # redefine ok() } Property { ##[ x <- Int( range=>[0,10] ) ]## cmp_ok( $x, '>=', 0, "" ); }, name => "cmp_ok() works with LectroTest";

Testing it out:

$ perl pm-lectrotest-testbuilder.pl 1..1 ok 1 - 'cmp_ok() works with LectroTest' (1000 attempts)

I hope that this helps.

Cheers,
Tom

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://427320]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-20 04:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found