remove extraneous garbage from tests
[gitmo/Class-C3.git] / t / 23_multi_init.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 1;
7
8 =pod
9
10 rt.cpan.org # 21558
11
12 If compile-time code from another module issues a [re]initialize() part-way
13 through the process of setting up own our modules, that shouldn't prevent
14 our own initialize() call from working properly.
15
16 =cut
17
18 {
19     package TestMRO::A;
20     use Class::C3;
21     sub testmethod { 42 }
22
23     package TestMRO::B;
24     use base 'TestMRO::A';
25     use Class::C3;
26
27     package TestMRO::C;
28     use base 'TestMRO::A';
29     use Class::C3;
30     sub testmethod { shift->next::method + 1 }
31
32     package TestMRO::D;
33     BEGIN { Class::C3::initialize }
34     use base 'TestMRO::B';
35     use base 'TestMRO::C';
36     use Class::C3;
37     sub new {
38         my $class = shift;
39         my $self = {};
40         bless $self => $class;
41     }
42 }
43
44 Class::C3::initialize;
45 is(TestMRO::D->new->testmethod, 43, 'double-initialize works ok');