use warnings;
use Test::More;
-use Test::Fatal;
+use Test::Exception;
=pod
use warnings;
use Moose::Role;
- ::ok ! ::exception {
+ ::lives_ok {
with 'Role::RequireFoo';
- }, '... the required "foo" method will not exist yet (but we will live)';
+ } '... the required "foo" method will not exist yet (but we will live)';
override 'foo' => sub { 'Role::ProvideFoo::foo' };
}
extends 'Class::ProvideFoo::Base';
- ::ok ! ::exception {
+ ::lives_ok {
with 'Role::RequireFoo';
- }, '... the required "foo" method will be found in the superclass';
+ } '... the required "foo" method will be found in the superclass';
override 'foo' => sub { 'Class::ProvideFoo::foo' };
override 'foo' => sub { 'Class::ProvideFoo::foo' };
- ::ok ! ::exception {
+ ::lives_ok {
with 'Role::RequireFoo';
- }, '... the required "foo" method exists, although it is overriden locally';
+ } '... the required "foo" method exists, although it is overriden locally';
}
extends 'Class::ProvideFoo::Base';
- ::ok ! ::exception {
+ ::lives_ok {
with 'Role::RequireFoo';
- }, '... the required "foo" method will be found in the superclass';
+ } '... the required "foo" method will be found in the superclass';
before 'foo' => sub { 'Class::ProvideFoo::foo:before' };
before 'foo' => sub { 'Class::ProvideFoo::foo:before' };
- ::ok ! ::exception {
+ ::lives_ok {
with 'Role::RequireFoo';
- }, '... the required "foo" method exists, although it is a before modifier locally';
+ } '... 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' };
- ::ok ! ::exception {
+ ::lives_ok {
with 'Role::RequireFoo';
- }, '... the required "foo" method exists locally, and it is modified locally';
+ } '... 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');
- ::ok ! ::exception {
+ ::lives_ok {
with 'Role::RequireFoo';
- }, '... the required "foo" method exists in the symbol table (and we will live)';
+ } '... the required "foo" method exists in the symbol table (and we will live)';
}
extends 'Class::ProvideFoo::Base';
- ::ok ! ::exception {
+ ::lives_ok {
with 'Role::RequireFoo';
- }, '... the required "foo" method will be found in the superclass (but then overriden)';
+ } '... the required "foo" method will be found in the superclass (but then overriden)';
has 'foo' => (is => 'ro');
has 'foo' => (is => 'ro');
- ::ok ! ::exception {
+ ::lives_ok {
with 'Role::RequireFoo';
- }, '... the required "foo" method exists, and is an accessor';
+ } '... the required "foo" method exists, and is an accessor';
}
# ...
use Moose;
extends 'Foo::Class::Base';
- ::ok ! ::exception {
+ ::lives_ok {
with 'Foo::Role';
- }, '... our role combined successfully';
+ } '... our role combined successfully';
}
# a method required in a role and implemented in a superclass, with a method
use Moose;
extends 'Bar::Class::Base';
after bar => sub { "o noes" };
- # technically we could run ok exception {} here, too, but putting it into a
+ # technically we could run lives_ok here, too, but putting it into a
# grandchild class makes it more obvious why this matters.
}
{
package Bar::Class::Grandchild;
use Moose;
extends 'Bar::Class::Child';
- ::ok ! ::exception {
+ ::lives_ok {
with 'Bar::Role';
- }, 'required method exists in superclass as non-modifier, so we live';
+ } 'required method exists in superclass as non-modifier, so we live';
}
{
use Moose;
extends 'Bar2::Class::Base';
override bar => sub { "o noes" };
- # technically we could run ok exception {} here, too, but putting it into a
+ # technically we could run lives_ok here, too, but putting it into a
# grandchild class makes it more obvious why this matters.
}
{
package Bar2::Class::Grandchild;
use Moose;
extends 'Bar2::Class::Child';
- ::ok ! ::exception {
+ ::lives_ok {
with 'Bar2::Role';
- }, 'required method exists in superclass as non-modifier, so we live';
+ } 'required method exists in superclass as non-modifier, so we live';
}
done_testing;