10 eval{ require Moose && Moose->VERSION(Mouse::Spec->MooseVersion) };
11 plan skip_all => "Moose $Mouse::Spec::MooseVersion required for this test" if $@;
29 ::lives_ok { extends qw(Foo) } "extend Mouse class with Moose";
36 } "new attr in subclass";
41 ::lives_ok { extends qw(Foo) } "extend Mouse class with Moose";
44 local our $TODO = "Moose not yet aware of Mouse meta";
49 } "clone and inherit attr in subclass";
63 ::lives_ok { extends qw(Quxx) } "extend Mouse class with Moose";
71 can_ok( Bar => "new" );
73 my $bar = eval { Bar->new };
75 ok( $bar, "got an object" );
76 isa_ok( $bar, "Bar" );
77 isa_ok( $bar, "Foo" );
79 can_ok( $bar, qw(foo bar) );
81 is( eval { $bar->foo }, undef, "no default value" );
82 is( eval { $bar->bar }, undef, "no default value" );
85 local $TODO = "Moose not yet aware of Mouse meta";
88 [ sort map { $_->name } Bar->meta->get_all_attributes ],
93 is( eval { Gorch->new->foo }, 3, "cloned and inherited attr's default" );
96 can_ok( Zork => "new" );
99 my $zork = eval { Zork->new };
101 ok( $zork, "got an object" );
102 isa_ok( $zork, "Zork" );
103 isa_ok( $zork, "Quxx" );
105 can_ok( $zork, qw(quxx zork) );
107 local $TODO = "Constructor needs to know default values of attrs from both";
108 is( eval { $bar->quxx }, "lala", "default value" );
109 is( eval { $bar->zork }, 42, "default value" );
113 my $zork = eval { Zork->new( zork => "diff", quxx => "blah" ) };
115 ok( $zork, "got an object" );
116 isa_ok( $zork, "Zork" );
117 isa_ok( $zork, "Quxx" );
119 can_ok( $zork, qw(quxx zork) );
121 local $TODO = "Constructor needs to know init args of attrs from both";
122 is( eval { $bar->quxx }, "blah", "constructor param" );
123 is( eval { $bar->zork }, "diff", "constructor param" );