8 plan skip_all => "Moose required for this test" unless eval { require Moose && Moose->VERSION('0.59') };
12 use Mouse::Util ':test';
26 ::lives_ok { extends qw(Foo) } "extend Mouse class with Moose";
33 } "new attr in subclass";
38 ::lives_ok { extends qw(Foo) } "extend Mouse class with Moose";
41 local our $TODO = "Moose not yet aware of Mouse meta";
46 } "clone and inherit attr in subclass";
60 ::lives_ok { extends qw(Quxx) } "extend Mouse class with Moose";
68 can_ok( Bar => "new" );
70 my $bar = eval { Bar->new };
72 ok( $bar, "got an object" );
73 isa_ok( $bar, "Bar" );
74 isa_ok( $bar, "Foo" );
76 can_ok( $bar, qw(foo bar) );
78 is( eval { $bar->foo }, undef, "no default value" );
79 is( eval { $bar->bar }, undef, "no default value" );
82 local $TODO = "Moose not yet aware of Mouse meta";
86 [ sort map { $_->name } Bar->meta->compute_all_applicable_attributes ],
91 is( eval { Gorch->new->foo }, 3, "cloned and inherited attr's default" );
94 can_ok( Zork => "new" );
97 my $zork = eval { Zork->new };
99 ok( $zork, "got an object" );
100 isa_ok( $zork, "Zork" );
101 isa_ok( $zork, "Quxx" );
103 can_ok( $zork, qw(quxx zork) );
105 local $TODO = "Constructor needs to know default values of attrs from both";
106 is( eval { $bar->quxx }, "lala", "default value" );
107 is( eval { $bar->zork }, 42, "default value" );
111 my $zork = eval { Zork->new( zork => "diff", quxx => "blah" ) };
113 ok( $zork, "got an object" );
114 isa_ok( $zork, "Zork" );
115 isa_ok( $zork, "Quxx" );
117 can_ok( $zork, qw(quxx zork) );
119 local $TODO = "Constructor needs to know init args of attrs from both";
120 is( eval { $bar->quxx }, "blah", "constructor param" );
121 is( eval { $bar->zork }, "diff", "constructor param" );