diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-06-06 17:50:16 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-06-06 17:50:16 +0000 |
commit | 5ac2026f7eed78958d69d051e7a8e993dcf51205 (patch) | |
tree | 298c3d2f08bdfe5689998b11892d72a897985be1 /t/roles/role_exclusion_and_alias_bug.t | |
download | Moose-tarball-5ac2026f7eed78958d69d051e7a8e993dcf51205.tar.gz |
Moose-2.1405HEADMoose-2.1405master
Diffstat (limited to 't/roles/role_exclusion_and_alias_bug.t')
-rw-r--r-- | t/roles/role_exclusion_and_alias_bug.t | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/t/roles/role_exclusion_and_alias_bug.t b/t/roles/role_exclusion_and_alias_bug.t new file mode 100644 index 0000000..dc4b0a5 --- /dev/null +++ b/t/roles/role_exclusion_and_alias_bug.t @@ -0,0 +1,67 @@ +use strict; +use warnings; + +use Test::More; +use Test::Moose; + +{ + package My::Role; + use Moose::Role; + + sub foo { "FOO" } + sub bar { "BAR" } +} + +{ + package My::Class; + use Moose; + + with 'My::Role' => { + -alias => { foo => 'baz', bar => 'gorch' }, + -excludes => ['foo', 'bar'], + }; +} + +{ + my $x = My::Class->new; + isa_ok($x, 'My::Class'); + does_ok($x, 'My::Role'); + + can_ok($x, $_) for qw[baz gorch]; + + ok(!$x->can($_), '... cant call method ' . $_) for qw[foo bar]; + + is($x->baz, 'FOO', '... got the right value'); + is($x->gorch, 'BAR', '... got the right value'); +} + +{ + package My::Role::Again; + use Moose::Role; + + with 'My::Role' => { + -alias => { foo => 'baz', bar => 'gorch' }, + -excludes => ['foo', 'bar'], + }; + + package My::Class::Again; + use Moose; + + with 'My::Role::Again'; +} + +{ + my $x = My::Class::Again->new; + isa_ok($x, 'My::Class::Again'); + does_ok($x, 'My::Role::Again'); + does_ok($x, 'My::Role'); + + can_ok($x, $_) for qw[baz gorch]; + + ok(!$x->can($_), '... cant call method ' . $_) for qw[foo bar]; + + is($x->baz, 'FOO', '... got the right value'); + is($x->gorch, 'BAR', '... got the right value'); +} + +done_testing; |