use warnings;
use Test::More;
-use Test::Fatal;
+use Test::Exception;
{
package Role::C;
use Moose::Role;
- ::ok ! ::exception {
+ ::lives_ok {
with qw(Role::A Role::B); # no conflict here
- }, "define role C";
+ } "define role C";
sub foo { 'Role::C::foo' }
sub zot { 'Role::C::zot' }
package Class::A;
use Moose;
- ::ok ! ::exception {
+ ::lives_ok {
with qw(Role::C);
- }, "define class A";
+ } "define class A";
sub zot { 'Class::A::zot' }
}
package Class::A::Conflict;
use Moose;
- ::like ::exception {
+ ::throws_ok {
with 'Role::A::Conflict';
- }, qr/Due to a method name conflict in roles 'Role::A' and 'Role::A::Conflict', the method 'bar' must be implemented or excluded by 'Class::A::Conflict'/, '... did not fufill the requirement of &bar method';
+ } qr/Due to a method name conflict in roles 'Role::A' and 'Role::A::Conflict', the method 'bar' must be implemented or excluded by 'Class::A::Conflict'/, '... did not fufill the requirement of &bar method';
package Class::A::Resolved;
use Moose;
- ::ok ! ::exception {
+ ::lives_ok {
with 'Role::A::Conflict';
- }, '... did fufill the requirement of &bar method';
+ } '... did fufill the requirement of &bar method';
sub bar { 'Class::A::Resolved::bar' }
}
package Role::F;
use Moose::Role;
- ::ok ! ::exception {
+ ::lives_ok {
with qw(Role::D Role::E); # conflict between 'foo's here
- }, "define role Role::F";
+ } "define role Role::F";
sub foo { 'Role::F::foo' }
sub zot { 'Role::F::zot' }
package Class::B;
use Moose;
- ::ok ! ::exception {
+ ::lives_ok {
with qw(Role::F);
- }, "define class Class::B";
+ } "define class Class::B";
sub zot { 'Class::B::zot' }
}
package Role::D::And::E::Conflict;
use Moose::Role;
- ::ok ! ::exception {
+ ::lives_ok {
with qw(Role::D Role::E); # conflict between 'foo's here
- }, "... define role Role::D::And::E::Conflict";
+ } "... define role Role::D::And::E::Conflict";
sub foo { 'Role::D::And::E::Conflict::foo' } # this overrides ...
package Role::I;
use Moose::Role;
- ::ok ! ::exception {
+ ::lives_ok {
with qw(Role::J Role::H); # conflict between 'foo's here
- }, "define role Role::I";
+ } "define role Role::I";
sub zot { 'Role::I::zot' }
sub zzy { 'Role::I::zzy' }
package Class::C;
use Moose;
- ::like ::exception {
+ ::throws_ok {
with qw(Role::I);
- }, qr/Due to a method name conflict in roles 'Role::H' and 'Role::J', the method 'foo' must be implemented or excluded by 'Class::C'/, "defining class Class::C fails";
+ } qr/Due to a method name conflict in roles 'Role::H' and 'Role::J', the method 'foo' must be implemented or excluded by 'Class::C'/, "defining class Class::C fails";
sub zot { 'Class::C::zot' }
package Class::E;
use Moose;
- ::ok ! ::exception {
+ ::lives_ok {
with qw(Role::I);
- }, "resolved with method";
+ } "resolved with method";
sub foo { 'Class::E::foo' }
sub zot { 'Class::E::zot' }
ok(Role::I->meta->requires_method('foo'), '... Role::I still have the &foo requirement');
{
- ok ! exception {
+ lives_ok {
package Class::D;
use Moose;
with qw(Role::I);
- }, "resolved with attr";
+ } "resolved with attr";
can_ok( Class::D->new, qw(foo bar xxy zot) );
is( eval { Class::D->new->bar }, "Role::H::bar", "bar" );