Uri Guttman wrote: > you need to wrap the call in block eval and check for die > afterwards. see perldoc -f eval and perlvar for $...@. note that this is > BLOCK eval which is fine to use anywhere you want to trap dies and not > string eval which is evil unless absolutely necessary. > > SB> is ($user->add_plan(\%plan_info), 0, "Don't want to die()!"); > > eval { $user->add_plan(\%plan_info) } ; > > is( $@, .... ) ;
Not only have I learnt about 'deeper' test modules such as Test::Deep and Test::Differences for future tests, but for some reason, the entire eval{} thing clicked after I read your message. I believe that it was simply the way you worded your note about the BLOCK eval... fwiw, and completeness, my temporary test, test case: eval { $user->add_plan(\%plan_info) } ; like ( $@, '/Bad API/', "${\(ref $user)}->add_plan() is terminated by " . "ISP::Error->bad_api() if an ISP::Error is not passed in" ); --- ok 45 - ISP::User->add_plan() is terminated by ISP::Error->bad_api() if an ISP::Error is not passed in Cheers! Steve
smime.p7s
Description: S/MIME Cryptographic Signature