6 use Test::More tests => 10;
15 This basically just makes sure that using +name
16 on role attributes works right.
27 default => sub { 10 },
36 has '+bar' => (default => sub { 100 });
37 } '... extended the attribute successfully';
43 is($foo->bar, 100, '... got the extended attribute');
63 } "... narrowed the role's type constraint successfully";
67 my $bar = Bar->new(foo => 42);
69 is($bar->foo, 42, '... got the extended attribute');
71 is($bar->foo, 100, "... can change the attribute's value to an Int");
73 throws_ok { $bar->foo("baz") } qr/^Attribute \(foo\) does not pass the type constraint because: Validation failed for 'Int' failed with value baz at /;
74 is($bar->foo, 100, "... still has the old Int value");