49c16e9f0409da19391612eb18d5029428c159da
[gitmo/Moose.git] / t / 020_attributes / 022_illegal_options_for_inheritance.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use Test::More;
6
7
8
9 {
10     package Bar::Meta::Attribute;
11     use Moose;
12
13     extends 'Moose::Meta::Attribute';
14
15     has 'my_illegal_option' => (
16       isa => 'CodeRef',
17       is => 'rw',
18     );
19
20     around illegal_options_for_inheritance => sub {
21       return (shift->(@_), qw/my_illegal_option/);
22     };
23
24     package Bar;
25     use Moose;
26
27     has 'bar' => (
28       metaclass       => 'Bar::Meta::Attribute',
29       my_illegal_option => sub { 'Bar' },
30       is => 'bare',
31     );
32 }
33
34 my $bar_attr = Bar->meta->get_attribute('bar');
35 my ($illegal_option) = grep {
36   $_ eq 'my_illegal_option'
37 } $bar_attr->illegal_options_for_inheritance;
38 is($illegal_option, 'my_illegal_option',
39   '... added my_illegal_option as illegal option for inheritance' );
40
41 done_testing;