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