Test-Fatal

 view release on metacpan or  search on metacpan

examples/exception_like.t  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use strict;
use warnings FATAL => 'all';
 
use Carp 'confess';
 
sub exception_like(&$;$)
{  
  my ($code, $pattern, $name) = @_;
  like( &exception($code), $pattern, $name );
}
 
exception_like(sub { confess 'blah blah' }, qr/foo/, 'foo seems to appear in the exception');
 
# the test only passes when we invert it
unlike(
    ( exception { confess 'blah blah' } || '' ),



( run in 0.250 second using v1.01-cache-2.11-cpan-94b05bcf43c )