Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: How not to test exceptions

by itub (Priest)
on Jul 22, 2005 at 02:11 UTC ( #477073=note: print w/replies, xml ) Need Help??


in reply to How not to test exceptions

I usually test my exceptions using Test::Exception, but I don't know if it plays well with the Error module.

Replies are listed 'Best First'.
Re^2: How not to test exceptions
by adrianh (Chancellor) on Jul 22, 2005 at 11:28 UTC
    I usually test my exceptions using Test::Exception, but I don't know if it plays well with the Error module.

    It should behave perfectly. Error is just some syntactic sugar around Perl's normal exception handling system. The OP's test would become the IMHO much more readable:

    use Test::More tests => 2; use Test::Exception; BEGIN { use_ok( 'MyModule' ) }; throws_ok { MyModule->foo( 'badparam'' ) } 'MyModule::Exception';

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2022-05-19 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (71 votes). Check out past polls.

    Notices?