use warnings;
use Test::More;
-use Test::Fatal;
+use Test::Exception;
use Test::Requires {
'IO::String' => '0.01', # skip all if not installed
is($email->as_string, '... this is my body ...', '... got correct string');
- ok ! exception {
+ lives_ok {
$email->raw_body('... this is the next body ...');
- }, '... this will coerce correctly';
+ } '... this will coerce correctly';
isa_ok($email->raw_body, 'IO::String');
my $str2 = '... this is the next body (ref) ...';
- ok ! exception {
+ lives_ok {
$email->raw_body(\$str2);
- }, '... this will coerce correctly';
+ } '... this will coerce correctly';
isa_ok($email->raw_body, 'IO::String');
my $io_str2 = IO::String->new('... this is the next body (IO::String) ...');
- ok ! exception {
+ lives_ok {
$email->raw_body($io_str2);
- }, '... this will coerce correctly';
+ } '... this will coerce correctly';
isa_ok($email->raw_body, 'IO::String');
is($email->raw_body, $io_str2, '... and it is the one we expected');
{
my $foo;
- ok ! exception { $foo = Foo->new( carray => 1 ) },
+ lives_ok { $foo = Foo->new( carray => 1 ) }
'Can pass non-ref value for carray';
is_deeply(
$foo->carray, [1],
'carray was coerced to an array ref'
);
- like exception { Foo->new( carray => {} ) },
+ throws_ok { Foo->new( carray => {} ) }
qr/\QValidation failed for 'Coerced|Coerced' with value \E(?!undef)/,
'Cannot pass a hash ref for carray attribute, and hash ref is not coerced to an undef';
}