X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F062_custom_instance.t;h=da03fdbbb58937530fcbf3a91daadb59b9d23545;hb=8371f3de4e9525ab751008dca4a89e6df65345a6;hp=0ec0c2181e2fbcfe30a6c20842df264115879c27;hpb=d65739b4429cbd77a5400b2ac8273af504fcf3da;p=gitmo%2FClass-MOP.git diff --git a/t/062_custom_instance.t b/t/062_custom_instance.t index 0ec0c21..da03fdb 100644 --- a/t/062_custom_instance.t +++ b/t/062_custom_instance.t @@ -2,7 +2,7 @@ use strict; use warnings; use Test::More; -use Test::Fatal; +use Test::Exception; use Class::MOP; @@ -45,7 +45,7 @@ my $instance; } undef $instance; -ok ! exception { +lives_and { my $foo = Foo::Sub->new; isa_ok($foo, 'Foo'); isa_ok($foo, 'Foo::Sub'); @@ -53,7 +53,7 @@ ok ! exception { }; undef $instance; -ok ! exception { +lives_and { my $foo = Foo::Sub->new(foo => 'FOO'); isa_ok($foo, 'Foo'); isa_ok($foo, 'Foo::Sub'); @@ -62,7 +62,7 @@ ok ! exception { }; undef $instance; -ok ! exception { +lives_and { my $foo = Foo::Sub->new(bar => 'bar'); isa_ok($foo, 'Foo'); isa_ok($foo, 'Foo::Sub'); @@ -71,7 +71,7 @@ ok ! exception { }; undef $instance; -ok ! exception { +lives_and { my $foo = Foo::Sub->new(foo => 'FOO', bar => 'bar'); isa_ok($foo, 'Foo'); isa_ok($foo, 'Foo::Sub'); @@ -117,25 +117,25 @@ ok ! exception { ); } -like exception { BadFoo::Sub->new }, +throws_ok { BadFoo::Sub->new } qr/BadFoo=HASH.*is not a BadFoo::Sub/, "error with incorrect constructors"; { my $meta = Class::MOP::Class->create('Really::Bad::Foo'); - like exception { + throws_ok { $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, '') { - like exception { + throws_ok { $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"; } }