X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F040-existing-subclass.t;h=52a9e5f049794a6e75fdbe3d0e8c5bdf97c7a18b;hb=8a3e5c5d45741e488e89d5130b5dcb44f2c6a6f4;hp=fe63fad73128aba5ae3272b9a613fb0f8e776b35;hpb=c7a6403fce1a32c7e91c65691aae43bb00838501;p=gitmo%2FMouse.git diff --git a/t/040-existing-subclass.t b/t/040-existing-subclass.t index fe63fad..52a9e5f 100644 --- a/t/040-existing-subclass.t +++ b/t/040-existing-subclass.t @@ -6,7 +6,7 @@ use Test::More; BEGIN { eval "use Test::Output;"; plan skip_all => "Test::Output is required for this test" if $@; - plan tests => 1; + plan tests => 3; } do { @@ -18,9 +18,42 @@ do { use Mouse; }; +TODO: { + local $TODO = "Mouse doesn't track enough context"; + stderr_is( + sub { Child->meta->make_immutable }, + "Not inlining a constructor for Child since it is not inheriting the default Mouse::Object constructor\n", + 'Mouse warns when it would have blown away the inherited constructor', + ); +} + +do { + package Foo; + use Mouse; + + __PACKAGE__->meta->make_immutable; + + package Bar; + use Mouse; + extends 'Foo'; + +}; + stderr_is( - sub { package Child; __PACKAGE__->meta->make_immutable }, - "Not inlining a constructor for Child since it is not inheriting the default Mouse::Object constructor\n", - 'Mouse warns when it would have blown away the inherited constructor', + sub { Bar->meta->make_immutable }, + "", + 'Mouse does not warn about inlining a constructor when the superclass inlined a constructor', ); +do { + package Baz; + + package Quux; + BEGIN { our @ISA = 'Baz' } + use Mouse; + + __PACKAGE__->meta->make_immutable; +}; + +ok(Quux->new); +