Add t/029-new.t for testing the constructor
[gitmo/Mouse.git] / t / 028-subclass-attr.t
CommitLineData
36062241 1#!/usr/bin/env perl
2use strict;
3use warnings;
28d26949 4use Test::More tests => 3;
36062241 5
6do {
7 package Class;
8 use Mouse;
9
10 has class => (
11 is => 'rw',
12 isa => 'Bool',
13 );
14
15 package Child;
16 use Mouse;
17 extends 'Class';
18
19 has child => (
20 is => 'rw',
21 isa => 'Bool',
22 );
23};
24
25my $obj = Child->new(class => 1, child => 1);
26ok($obj->child, "local attribute set in constructor");
27ok($obj->class, "inherited attribute set in constructor");
28d26949 28
29is_deeply([Child->meta->compute_all_applicable_attributes], [
30 Child->meta->get_attribute('child'),
31 Class->meta->get_attribute('class'),
32], "correct compute_all_applicable_attributes");
33