Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: testing a croak

by tirwhan (Abbot)
on Jan 19, 2006 at 14:38 UTC ( [id://524239]=note: print w/replies, xml ) Need Help??


in reply to Re^2: testing a croak
in thread testing a croak

If you load Test::Exception with use_ok you need to do so in a BEGIN block.

BEGIN { use_ok('Test::Exception'}; }

will work.


There are ten types of people: those that understand binary and those that don't.

Replies are listed 'Best First'.
Re^4: testing a croak
by Anonymous Monk on Jan 19, 2006 at 14:39 UTC
    I am doing that

      Hmm, that's odd, can you post a cut-down (but complete) version of your code which shows this problem. I.e. a complete runnable test script with only the one test and the code it calls which dies? Something like this:

      use Test::More tests => 2; BEGIN { use_ok("Test::Exception"); } sub slayme { die "Error message"; } throws_ok { slayme() } qr/Error message/,"Dies correctly"; __OUTPUT__ 1..2 ok 1 - use Test::Exception; ok 2 - Dies correctly

      There are ten types of people: those that understand binary and those that don't.
        thanks for your help... I figured it out

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-19 13:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found