complete re-organization of the test suite
[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 tests => 4;
7 use Test::Exception;
8
9 BEGIN {
10     use_ok('Moose');
11 }
12
13 {
14     package My::Custom::Meta::Attr;
15     use Moose;
16     
17     extends 'Moose::Meta::Attribute';
18 }
19
20 {
21     package My::Fancy::Role;
22     use Moose::Role;
23     
24     has 'bling_bling' => (
25         metaclass => 'My::Custom::Meta::Attr',
26         is        => 'rw',
27         isa       => 'Str',
28     );
29 }
30
31 {
32     package My::Class;
33     use Moose;
34     
35     with 'My::Fancy::Role';
36 }
37
38 my $c = My::Class->new;
39 isa_ok($c, 'My::Class');
40
41 ok($c->meta->has_attribute('bling_bling'), '... got the attribute');
42
43 isa_ok($c->meta->get_attribute('bling_bling'), 'My::Custom::Meta::Attr');
44
45