$ cat test_exit.pl
use strict;
use warnings;
sub killer { die "hasta la vista baby"; }
sub exiter { exit(42); }
1;
__END__
$ cat test_exit.t
use warnings;
use strict;
use Test::More tests => 2;
use Test::Exception;
ok(require('test_exit.pl'), 'loaded');
throws_ok( sub { killer () }, qr/hasta la vista baby/, q{Expected kill
+er to die});
__END__
$ prove test_exit.t
test_exit....ok
All tests successful.
Files=1, Tests=2, 0 wallclock secs ( 0.04 cusr + 0.01 csys = 0.05 C
+PU)
Now I wonder what kind of tricks I can use to test
exit in the same way as
die?
is a brilliant solution. Thanks