complain about unsafe fixing, since cmop doesn't anymore
[gitmo/Moose.git] / t / 050_metaclasses / 001_custom_attr_meta_with_roles.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Exception;
8
9
10 {
11     package My::Custom::Meta::Attr;
12     use Moose;
13
14     extends 'Moose::Meta::Attribute';
15 }
16
17 {
18     package My::Fancy::Role;
19     use Moose::Role;
20
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;
31
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
42 done_testing;