use strict;
use warnings;
-use Test::More tests => 84;
+use Test::More tests => 85;
use Test::Exception;
BEGIN {
has '+one_last_one' => (isa => subtype('Ref', where { blessed $_ eq 'CODE' }));
} '... extend an attribute with anon-subtype';
- ::dies_ok {
+ ::lives_ok {
has '+one_last_one' => (isa => 'Value');
- } '... cannot extend an attribute with a non-subtype';
-
+ } '... now can extend an attribute with a non-subtype';
+
+ ::lives_ok {
+ has '+foo' => ( metaclass => 'DoNotSerialize' );
+ } 'Can add metaclass attribute option';
+
+ ::lives_ok {
+ has '+foo' => ( traits => [ 'DoNotSerialize' ] );
+ } 'Can add traits attribute option';
+
::lives_ok {
has '+bling' => (handles => ['hello']);
} '... we can add the handles attribute option';
::dies_ok {
has '+blang' => (handles => ['hello']);
} '... we can not alter the handles attribute option';
- ::dies_ok {
+ ::lives_ok {
has '+fail' => (isa => 'Ref');
- } '... cannot create an attribute with an improper subtype relation';
+ } '... can now create an attribute with an improper subtype relation';
::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';
- ::dies_ok {
- has '+other_fail' => (isa => 'WangDoodle');
- } '... cannot create an attribute with a non-existent type';
-
}
my $foo = Foo->new;
ok(Bar->meta->has_attribute('bling'), '... Bar has a bling attr');
ok(Bar->meta->has_attribute('bunch_of_stuff'), '... Bar does have a bunch_of_stuff attr');
ok(!Bar->meta->has_attribute('blang'), '... Bar has a blang attr');
-ok(!Bar->meta->has_attribute('fail'), '... Bar does not have a fail attr');
-ok(!Bar->meta->has_attribute('other_fail'), '... Bar does not have a fail attr');
+ok(Bar->meta->has_attribute('fail'), '... Bar has a fail attr');
+ok(!Bar->meta->has_attribute('other_fail'), '... Bar does not have an other_fail attr');
isnt(Foo->meta->get_attribute('foo'),
Bar->meta->get_attribute('foo'),