Commit | Line | Data |
---|---|---|
ac0ece3d | 1 | #!/usr/bin/perl |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
7ff56534 | 6 | use Test::More tests => 3; |
ac0ece3d | 7 | use Test::Exception; |
8 | ||
7ff56534 | 9 | |
ac0ece3d | 10 | |
11 | { | |
12 | package My::Custom::Meta::Attr; | |
13 | use Moose; | |
d03bd989 | 14 | |
ac0ece3d | 15 | extends 'Moose::Meta::Attribute'; |
16 | } | |
17 | ||
18 | { | |
19 | package My::Fancy::Role; | |
20 | use Moose::Role; | |
d03bd989 | 21 | |
ac0ece3d | 22 | has 'bling_bling' => ( |
23 | metaclass => 'My::Custom::Meta::Attr', | |
24 | is => 'rw', | |
25 | isa => 'Str', | |
26 | ); | |
27 | } | |
28 | ||
29 | { | |
30 | package My::Class; | |
31 | use Moose; | |
d03bd989 | 32 | |
ac0ece3d | 33 | with 'My::Fancy::Role'; |
34 | } | |
35 | ||
36 | my $c = My::Class->new; | |
37 | isa_ok($c, 'My::Class'); | |
38 | ||
39 | ok($c->meta->has_attribute('bling_bling'), '... got the attribute'); | |
40 | ||
41 | isa_ok($c->meta->get_attribute('bling_bling'), 'My::Custom::Meta::Attr'); | |
42 | ||
43 |