X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F300_immutable%2F001_immutable_moose.t;h=b969268e7c6a3a36f47c6d6bf09005394c194063;hb=53a4d826caec4b82f5b23e0bc0a4e8e2f44243b9;hp=aa90d6db69da06d60948bbcfef842ffb7270c72e;hpb=478b11a96fdfd6d0b2cc20214fb9e4645b6ef75c;p=gitmo%2FMoose.git diff --git a/t/300_immutable/001_immutable_moose.t b/t/300_immutable/001_immutable_moose.t index aa90d6d..b969268 100644 --- a/t/300_immutable/001_immutable_moose.t +++ b/t/300_immutable/001_immutable_moose.t @@ -4,7 +4,7 @@ use strict; use warnings; use Test::More; -use Test::Fatal; +use Test::Exception; use Moose::Meta::Role; @@ -33,25 +33,25 @@ use Moose::Meta::Role; my $foo_role = Moose::Meta::Role->initialize('FooRole'); my $meta = Foo->meta; - ok ! exception { Foo->new }, "lazy_build works"; + lives_ok { Foo->new } "lazy_build works"; is( Foo->new->foos, 'many foos', "correct value for 'foos' before inlining constructor" ); is( Foo->new->bars, 'many bars', "correct value for 'bars' before inlining constructor" ); is( Foo->new->bazes, 'many bazes', "correct value for 'bazes' before inlining constructor" ); - ok ! exception { $meta->make_immutable }, "Foo is imutable"; - ok ! exception { $meta->identifier }, "->identifier on metaclass lives"; - ok exception { $meta->add_role($foo_role) }, "Add Role is locked"; - ok ! exception { Foo->new }, "Inlined constructor works with lazy_build"; + lives_ok { $meta->make_immutable } "Foo is imutable"; + lives_ok { $meta->identifier } "->identifier on metaclass lives"; + dies_ok { $meta->add_role($foo_role) } "Add Role is locked"; + lives_ok { Foo->new } "Inlined constructor works with lazy_build"; is( Foo->new->foos, 'many foos', "correct value for 'foos' after inlining constructor" ); is( Foo->new->bars, 'many bars', "correct value for 'bars' after inlining constructor" ); is( Foo->new->bazes, 'many bazes', "correct value for 'bazes' after inlining constructor" ); - ok ! exception { $meta->make_mutable }, "Foo is mutable"; - ok ! exception { $meta->add_role($foo_role) }, "Add Role is unlocked"; + lives_ok { $meta->make_mutable } "Foo is mutable"; + lives_ok { $meta->add_role($foo_role) } "Add Role is unlocked"; } @@ -73,10 +73,10 @@ use Moose::Meta::Role; sub BUILD { 'baz' } } -ok ! exception { Bar->meta->make_immutable }, +lives_ok { Bar->meta->make_immutable } 'Immutable meta with single BUILD'; -ok ! exception { Baz->meta->make_immutable }, +lives_ok { Baz->meta->make_immutable } 'Immutable meta with multiple BUILDs'; =pod