Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

61 lines (50 sloc) 1.184 kb
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Fatal;
do {
package MyRole::Excluder;
use MooseX::Role::Parameterized;
parameter exclude => (
is => 'rw',
isa => 'Str',
);
role {
my $p = shift;
excludes $p->exclude;
};
};
Moose::Meta::Role->create("Role::A");
Moose::Meta::Role->create("Role::B");
my @keep_roles_alive;
sub excludes_roles {
map {
my $role = MyRole::Excluder->meta->generate_role(
parameters => {
exclude => $_,
},
);
push @keep_roles_alive, $role;
$role->name;
} @_
}
is (exception {
Moose::Meta::Class->create_anon_class(
roles => [ excludes_roles('Role::A') ],
);
}, undef);
{
my ($role_name) = excludes_roles('Role::A');
like( exception {
Moose::Meta::Class->create_anon_class(
roles => [ 'Role::A', $role_name ],
);
}, qr/^Conflict detected: Role $role_name excludes role 'Role::A'/);
}
is (exception {
Moose::Meta::Class->create_anon_class(
roles => [ 'Role::B', excludes_roles('Role::A') ],
);
}, undef);
done_testing;
Jump to Line
Something went wrong with that request. Please try again.