Commit | Line | Data |
c7a6403f |
1 | #!/usr/bin/env perl |
2 | use strict; |
3 | use warnings; |
4 | use Test::More; |
5 | |
6 | BEGIN { |
7 | eval "use Test::Output;"; |
8 | plan skip_all => "Test::Output is required for this test" if $@; |
58600853 |
9 | plan tests => 3; |
c7a6403f |
10 | } |
11 | |
12 | do { |
13 | package Parent; |
14 | sub new { bless {}, shift } |
15 | |
16 | package Child; |
17 | BEGIN { our @ISA = 'Parent' } |
18 | use Mouse; |
19 | }; |
20 | |
e3e524d9 |
21 | TODO: { |
22 | local $TODO = "Mouse doesn't track enough context"; |
23 | stderr_is( |
24 | sub { Child->meta->make_immutable }, |
25 | "Not inlining a constructor for Child since it is not inheriting the default Mouse::Object constructor\n", |
26 | 'Mouse warns when it would have blown away the inherited constructor', |
27 | ); |
28 | } |
29 | |
30 | do { |
31 | package Foo; |
32 | use Mouse; |
33 | |
34 | __PACKAGE__->meta->make_immutable; |
35 | |
36 | package Bar; |
37 | use Mouse; |
38 | extends 'Foo'; |
39 | |
40 | }; |
41 | |
c7a6403f |
42 | stderr_is( |
e3e524d9 |
43 | sub { Bar->meta->make_immutable }, |
44 | "", |
45 | 'Mouse does not warn about inlining a constructor when the superclass inlined a constructor', |
c7a6403f |
46 | ); |
47 | |
58600853 |
48 | do { |
49 | package Baz; |
50 | |
51 | package Quux; |
52 | BEGIN { our @ISA = 'Baz' } |
53 | use Mouse; |
54 | |
55 | __PACKAGE__->meta->make_immutable; |
56 | }; |
57 | |
58 | ok(Quux->new); |
59 | |