http://www.perlmonks.org?node_id=413210


in reply to Test::More usage to test functions that die

One way is to overload croak() inside your test, then make sure that calling your function calls croak() under the right circumstances. E.g.:
# (pseudocode) our $croakcount; sub main::croak { $croakcount++; } myfunc(my $badoptions); is ($croakcount, 1, "myfunc() calls croak()");