version bump + potential fix for rt.cpan.org #12558
[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 => 2;
7
8 BEGIN {
9     use_ok('Class::C3');
10 }
11
12 =pod
13
14 rt.cpan.org # 21558
15
16 If compile-time code from another module issues a [re]initialize() part-way
17 through the process of setting up own our modules, that shouldn't prevent
18 our own initialize() call from working properly.
19
20 =cut
21
22 {
23     package TestMRO::A;
24     use Class::C3;
25     sub testmethod { 42 }
26
27     package TestMRO::B;
28     use base 'TestMRO::A';
29     use Class::C3;
30
31     package TestMRO::C;
32     use base 'TestMRO::A';
33     use Class::C3;
34     sub testmethod { shift->next::method + 1 }
35
36     package TestMRO::D;
37     BEGIN { Class::C3::initialize }
38     use base 'TestMRO::B';
39     use base 'TestMRO::C';
40     use Class::C3;
41     sub new {
42         my $class = shift;
43         my $self = {};
44         bless $self => $class;
45     }
46 }
47
48 Class::C3::initialize;
49 is(TestMRO::D->new->testmethod, 43, 'double-initialize works ok');