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