6 use Test::More 'no_plan';
7 use Mouse::Util ':test';
21 ::lives_ok { extends qw(Foo) } "extend Mouse class with Moose";
28 } "new attr in subclass";
33 ::lives_ok { extends qw(Foo) } "extend Mouse class with Moose";
36 local our $TODO = "Moose not yet aware of Mouse meta";
41 } "clone and inherit attr in subclass";
55 ::lives_ok { extends qw(Quxx) } "extend Mouse class with Moose";
63 can_ok( Bar => "new" );
65 my $bar = eval { Bar->new };
67 ok( $bar, "got an object" );
68 isa_ok( $bar, "Bar" );
69 isa_ok( $bar, "Foo" );
71 can_ok( $bar, qw(foo bar) );
73 is( eval { $bar->foo }, undef, "no default value" );
74 is( eval { $bar->bar }, undef, "no default value" );
77 local $TODO = "Moose not yet aware of Mouse meta";
81 [ sort map { $_->name } Bar->meta->compute_all_applicable_attributes ],
86 is( eval { Gorch->new->foo }, 3, "cloned and inherited attr's default" );
89 can_ok( Zork => "new" );
92 my $zork = eval { Zork->new };
94 ok( $zork, "got an object" );
95 isa_ok( $zork, "Zork" );
96 isa_ok( $zork, "Quxx" );
98 can_ok( $zork, qw(quxx zork) );
100 local $TODO = "Constructor needs to know default values of attrs from both";
101 is( eval { $bar->quxx }, "lala", "default value" );
102 is( eval { $bar->zork }, 42, "default value" );
106 my $zork = eval { Zork->new( zork => "diff", quxx => "blah" ) };
108 ok( $zork, "got an object" );
109 isa_ok( $zork, "Zork" );
110 isa_ok( $zork, "Quxx" );
112 can_ok( $zork, qw(quxx zork) );
114 local $TODO = "Constructor needs to know init args of attrs from both";
115 is( eval { $bar->quxx }, "blah", "constructor param" );
116 is( eval { $bar->zork }, "diff", "constructor param" );