X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F050_metaclasses%2F013_metaclass_traits.t;h=a96d95e5a7c3052d14c6ce04deecb7653322eace;hb=b10dde3a27c11623547417c599ccbd4f92e42651;hp=dcab7bdd7b4edb3565493ac6fae163866fdc1570;hpb=d4e538d9bf46d1c14d2ecfd36ac35ed541ae7ee6;p=gitmo%2FMoose.git diff --git a/t/050_metaclasses/013_metaclass_traits.t b/t/050_metaclasses/013_metaclass_traits.t index dcab7bd..a96d95e 100644 --- a/t/050_metaclasses/013_metaclass_traits.t +++ b/t/050_metaclasses/013_metaclass_traits.t @@ -6,7 +6,7 @@ use warnings; use lib 't/lib', 'lib'; use Test::More; -use Test::Exception; +use Test::Fatal; { package My::SimpleTrait; @@ -167,10 +167,14 @@ is( Role::Foo->meta()->simple(), 5, { require Moose::Util::TypeConstraints; - dies_ok { Moose::Util::TypeConstraints->import( -traits => 'My::SimpleTrait' ) } - 'cannot provide -traits to an exporting module that does not init_meta'; - like( $@, qr/does not have an init_meta/, - '... and error provides a useful explanation' ); + like( + exception { + Moose::Util::TypeConstraints->import( + -traits => 'My::SimpleTrait' ); + }, + qr/does not have an init_meta/, + 'cannot provide -traits to an exporting module that does not init_meta' + ); } { @@ -198,11 +202,10 @@ is( Foo::Subclass->meta()->attr2(), 'something', has an_attr => ( is => 'ro' ); } -lives_ok { +is( exception { my $instance = Class::WithAlreadyPresentTrait->new( an_attr => 'value' ); is( $instance->an_attr, 'value', 'Can get value' ); -} -'Can create instance and access attributes'; +}, undef, 'Can create instance and access attributes' ); { @@ -215,10 +218,9 @@ lives_ok { has an_attr => ( is => 'ro' ); } -lives_ok { +is( exception { my $instance = Class::WhichLoadsATraitFromDisk->new( an_attr => 'value' ); is( $instance->an_attr, 'value', 'Can get value' ); -} -'Can create instance and access attributes'; +}, undef, 'Can create instance and access attributes' ); done_testing;