before => sub {
my $meta = _find_meta();
return subname 'Moose::Role::before' => sub (@&) {
+ confess "Moose::Role does not currently support 'before'";
my $code = pop @_;
$meta->add_before_method_modifier($_, $code) for @_;
};
after => sub {
my $meta = _find_meta();
return subname 'Moose::Role::after' => sub (@&) {
+ confess "Moose::Role does not currently support 'after'";
my $code = pop @_;
$meta->add_after_method_modifier($_, $code) for @_;
};
around => sub {
my $meta = _find_meta();
return subname 'Moose::Role::around' => sub (@&) {
+ confess "Moose::Role does not currently support 'around'";
my $code = pop @_;
$meta->add_around_method_modifier($_, $code) for @_;
};
override => sub {
my $meta = _find_meta();
return subname 'Moose::Role::override' => sub ($&) {
- my ($name, $code) = @_;
- $meta->add_override_method_modifier($name, $code);
+ confess "Moose::Role cannot support 'override'";
};
},
inner => sub {
my $meta = _find_meta();
return subname 'Moose::Role::inner' => sub {
- confess "Moose::Role does not currently support 'inner'";
+ confess "Moose::Role cannot support 'inner'";
};
},
augment => sub {
my $meta = _find_meta();
return subname 'Moose::Role::augment' => sub {
- confess "Moose::Role does not currently support 'augment'";
+ confess "Moose::Role cannot support 'augment'";
};
},
confess => sub {
use strict;
use warnings;
-use Test::More tests => 35;
+use Test::More tests => 1;
use Test::Exception;
BEGIN {
=cut
+=begin nonsense
+
{
package FooRole;
use Moose::Role;
[ 'bling', 'fling' ],
'... got the right list of override method modifiers');
+=cut
use strict;
use warnings;
-use Test::More tests => 39;
+use Test::More tests => 1;
use Test::Exception;
BEGIN {
use_ok('Moose::Role');
}
+=begin nonsense
+
{
package FooRole;
use Moose::Role;
is($foo->boo, 'FooRole::boo -> BarClass::boo', '... got the right value from ->boo');
is($foo->blau, 'FooRole::blau -> FooClass::blau', '... got the right value from ->blau');
+=cut
+
use strict;
use warnings;
-use Test::More tests => 90;
+use Test::More tests => 44;
use Test::Exception;
BEGIN {
=cut
+=begin nonsense
+
{
package Role::Bling;
use Moose::Role;
=cut
+=begin nonsense
+
{
package Role::Plot;
use Moose::Role;
is(Role::Reality->meta->get_method('twist')->(),
'Role::Reality::twist',
'... the twist method returns the right value');
+
+=cut
use strict;
use warnings;
-use Test::More tests => 17;
+use Test::More tests => 15;
use Test::Exception;
BEGIN {
use Moose::Role;
requires 'foo';
-
+
+}
+
+=begin nonsense
package Role::ProvideFoo;
use strict;
use warnings;
[ 'foo' ],
'... foo method is still required for Role::ProvideFoo');
+=cut
+
=pod
Role which requires a method implemented
} '... the required "foo" method exists, but it is a before (and we will die)';
}
-
\ No newline at end of file
+
use strict;
use warnings;
-use Test::More tests => 34;
+use Test::More tests => 14;
use Test::Exception;
BEGIN {
=cut
+=begin nonesense
+
{
package Role::Base2;
use Moose::Role;
is(My::Test::Class2::Base->foo, 'My::Test::Class2::Base', '... got the right value from method');
is(My::Test::Class2->foo, 'My::Test::Class2::Base -> Role::Base::foo', '... got the right value from method');
+=cut
+
=pod
Check for repeated inheritence of the
=cut
+=begin nonesense
+
{
package Role::Base3;
use Moose::Role;
is(My::Test::Class3::Base->foo, 'My::Test::Class3::Base', '... got the right value from method');
is(My::Test::Class3->foo, 'Role::Base::foo(My::Test::Class3::Base)', '... got the right value from method');
+=cut
+
=pod
Check for repeated inheritence causing
use strict;
use warnings;
-use Test::More tests => 77;
+use Test::More tests => 10;
use Test::Exception;
BEGIN {
is($foo_rv, "RootA::foo", "... got the right foo rv");
}
+=begin nonsense
+
{
# NOTE:
# this edge cases shows the application of
# this test, I am not sure we are testing anything
# useful here (although more tests cant hurt)
+
{
use List::Util qw/shuffle/;
is( eval { $class->method }, "concrete b", "provided by concrete b" );
}
}
+
+=cut
use strict;
use warnings;
-use Test::More tests => 21;
+use Test::More tests => 1;
use Test::Exception;
BEGIN {
## Roles
+=begin nonsense
+
{
package Constraint;
use Moose::Role;
ok(!defined($at_least_10_chars->validate('barrrrrrrrr')), '... validated correctly');
is($at_least_10_chars->validate('bar'), 'must be at least 10 chars', '... validation failed correctly');
+=cut