use warnings;
use Test::More;
-use Test::Exception;
+use Test::Fatal;
=pod
use warnings;
use Moose::Role;
- ::lives_ok {
+ ::is( ::exception {
with 'Role::RequireFoo';
- } '... the required "foo" method will not exist yet (but we will live)';
+ }, undef, '... the required "foo" method will not exist yet (but we will live)' );
override 'foo' => sub { 'Role::ProvideFoo::foo' };
}
extends 'Class::ProvideFoo::Base';
- ::lives_ok {
+ ::is( ::exception {
with 'Role::RequireFoo';
- } '... the required "foo" method will be found in the superclass';
+ }, undef, '... the required "foo" method will be found in the superclass' );
override 'foo' => sub { 'Class::ProvideFoo::foo' };
override 'foo' => sub { 'Class::ProvideFoo::foo' };
- ::lives_ok {
+ ::is( ::exception {
with 'Role::RequireFoo';
- } '... the required "foo" method exists, although it is overriden locally';
+ }, undef, '... the required "foo" method exists, although it is overriden locally' );
}
extends 'Class::ProvideFoo::Base';
- ::lives_ok {
+ ::is( ::exception {
with 'Role::RequireFoo';
- } '... the required "foo" method will be found in the superclass';
+ }, undef, '... the required "foo" method will be found in the superclass' );
before 'foo' => sub { 'Class::ProvideFoo::foo:before' };
before 'foo' => sub { 'Class::ProvideFoo::foo:before' };
- ::lives_ok {
+ ::is( ::exception {
with 'Role::RequireFoo';
- } '... the required "foo" method exists, although it is a before modifier locally';
+ }, undef, '... the required "foo" method exists, although it is a before modifier locally' );
package Class::ProvideFoo::Before3;
use Moose;
sub foo { 'Class::ProvideFoo::foo' }
before 'foo' => sub { 'Class::ProvideFoo::foo:before' };
- ::lives_ok {
+ ::is( ::exception {
with 'Role::RequireFoo';
- } '... the required "foo" method exists locally, and it is modified locally';
+ }, undef, '... the required "foo" method exists locally, and it is modified locally' );
package Class::ProvideFoo::Before4;
use Moose;
::is(__PACKAGE__->meta->get_method('foo')->get_original_method->package_name, __PACKAGE__,
'... but the original method is from our package');
- ::lives_ok {
+ ::is( ::exception {
with 'Role::RequireFoo';
- } '... the required "foo" method exists in the symbol table (and we will live)';
+ }, undef, '... the required "foo" method exists in the symbol table (and we will live)' );
}
extends 'Class::ProvideFoo::Base';
- ::lives_ok {
+ ::is( ::exception {
with 'Role::RequireFoo';
- } '... the required "foo" method will be found in the superclass (but then overriden)';
+ }, undef, '... the required "foo" method will be found in the superclass (but then overriden)' );
has 'foo' => (is => 'ro');
has 'foo' => (is => 'ro');
- ::lives_ok {
+ ::is( ::exception {
with 'Role::RequireFoo';
- } '... the required "foo" method exists, and is an accessor';
+ }, undef, '... the required "foo" method exists, and is an accessor' );
}
# ...
use Moose;
extends 'Foo::Class::Base';
- ::lives_ok {
+ ::is( ::exception {
with 'Foo::Role';
- } '... our role combined successfully';
+ }, undef, '... our role combined successfully' );
}
# a method required in a role and implemented in a superclass, with a method
package Bar::Class::Grandchild;
use Moose;
extends 'Bar::Class::Child';
- ::lives_ok {
+ ::is( ::exception {
with 'Bar::Role';
- } 'required method exists in superclass as non-modifier, so we live';
+ }, undef, 'required method exists in superclass as non-modifier, so we live' );
}
{
package Bar2::Class::Grandchild;
use Moose;
extends 'Bar2::Class::Child';
- ::lives_ok {
+ ::is( ::exception {
with 'Bar2::Role';
- } 'required method exists in superclass as non-modifier, so we live';
+ }, undef, 'required method exists in superclass as non-modifier, so we live' );
}
done_testing;