use strict;
use warnings;
use Test::More;
-use Test::Exception;
+use Test::Fatal;
use Class::MOP;
}
undef $instance;
-lives_and {
+ok ! exception {
my $foo = Foo::Sub->new;
isa_ok($foo, 'Foo');
isa_ok($foo, 'Foo::Sub');
};
undef $instance;
-lives_and {
+ok ! exception {
my $foo = Foo::Sub->new(foo => 'FOO');
isa_ok($foo, 'Foo');
isa_ok($foo, 'Foo::Sub');
};
undef $instance;
-lives_and {
+ok ! exception {
my $foo = Foo::Sub->new(bar => 'bar');
isa_ok($foo, 'Foo');
isa_ok($foo, 'Foo::Sub');
};
undef $instance;
-lives_and {
+ok ! exception {
my $foo = Foo::Sub->new(foo => 'FOO', bar => 'bar');
isa_ok($foo, 'Foo');
isa_ok($foo, 'Foo::Sub');
);
}
-throws_ok { BadFoo::Sub->new }
+like exception { BadFoo::Sub->new },
qr/BadFoo=HASH.*is not a BadFoo::Sub/,
"error with incorrect constructors";
{
my $meta = Class::MOP::Class->create('Really::Bad::Foo');
- throws_ok {
+ like exception {
$meta->new_object(__INSTANCE__ => (bless {}, 'Some::Other::Class'))
- } qr/Some::Other::Class=HASH.*is not a Really::Bad::Foo/,
- "error with completely invalid class";
+ }, qr/Some::Other::Class=HASH.*is not a Really::Bad::Foo/,
+ "error with completely invalid class";
}
{
my $meta = Class::MOP::Class->create('Really::Bad::Foo::2');
for my $invalid ('foo', 1, 0, '') {
- throws_ok {
+ like exception {
$meta->new_object(__INSTANCE__ => $invalid)
- } qr/The __INSTANCE__ parameter must be a blessed reference, not $invalid/,
- "error with unblessed thing";
+ }, qr/The __INSTANCE__ parameter must be a blessed reference, not $invalid/,
+ "error with unblessed thing";
}
}