Require Dist::Zilla 4.200016+
[gitmo/Moose.git] / t / metaclasses / custom_attr_meta_with_roles.t
CommitLineData
ac0ece3d 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
a28e50e4 6use Test::More;
ac0ece3d 7
7ff56534 8
ac0ece3d 9{
10 package My::Custom::Meta::Attr;
11 use Moose;
d03bd989 12
ac0ece3d 13 extends 'Moose::Meta::Attribute';
14}
15
16{
17 package My::Fancy::Role;
18 use Moose::Role;
d03bd989 19
ac0ece3d 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;
d03bd989 30
ac0ece3d 31 with 'My::Fancy::Role';
32}
33
34my $c = My::Class->new;
35isa_ok($c, 'My::Class');
36
37ok($c->meta->has_attribute('bling_bling'), '... got the attribute');
38
39isa_ok($c->meta->get_attribute('bling_bling'), 'My::Custom::Meta::Attr');
40
a28e50e4 41done_testing;