Implement inversed logic when defining which attribute options can be changed
[gitmo/Moose.git] / t / 020_attributes / 022_illegal_options_for_inheritance.t
CommitLineData
7782e1da 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use 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
34my $bar_attr = Bar->meta->get_attribute('bar');
35my ($illegal_option) = grep {
36 $_ eq 'my_illegal_option'
37} $bar_attr->illegal_options_for_inheritance;
38is($illegal_option, 'my_illegal_option',
39 '... added my_illegal_option as illegal option for inheritance' );
40
41done_testing;