use strict;
use warnings;
-use Test::More tests => 84;
+use Test::More;
use Test::Exception;
-
{
+ package Thing::Meta::Attribute;
+ use Moose;
+
+ extends 'Moose::Meta::Attribute';
+ around illegal_options_for_inheritance => sub {
+ return (shift->(@_), qw/trigger/);
+ };
+
package Thing;
use Moose;
has 'gorch' => (is => 'ro');
has 'gloum' => (is => 'ro', default => sub {[]});
+ has 'fleem' => (is => 'ro');
has 'bling' => (is => 'ro', isa => 'Thing');
has 'blang' => (is => 'ro', isa => 'Thing', handles => ['goodbye']);
# this one will work here ....
has 'fail' => (isa => 'CodeRef', is => 'bare');
- has 'other_fail' => (is => 'bare');
+ has 'other_fail' => (metaclass => 'Thing::Meta::Attribute', is => 'bare', trigger => sub { });
package Bar;
use Moose;
} '... now can extend an attribute with a non-subtype';
::lives_ok {
+ has '+fleem' => (weak_ref => 1);
+ } '... now allowed to add the weak_ref option via inheritance';
+
+ ::lives_ok {
has '+bling' => (handles => ['hello']);
} '... we can add the handles attribute option';
::dies_ok {
has '+other_fail' => (trigger => sub {});
} '... cannot create an attribute with an illegal option';
- ::dies_ok {
- has '+other_fail' => (weak_ref => 1);
- } '... cannot create an attribute with an illegal option';
::throws_ok {
has '+does_not_exist' => (isa => 'Str');
} qr/in Bar/, '... cannot extend a non-existing attribute';
ok(Bar->meta->get_attribute('bling')->has_handles,
'... Bar::foo should handles');
-
+done_testing;