Use eval BLOCK.
eval { die "Wibble\n"; }; is( $@, "Wibble\n" );
Use the same technique to check that things didn't die.
is( eval { the_function_that_wouldnt_die() }, 42 ) || diag $@;
Prev | toc | Next