adding the some preliminary junk
[gitmo/Class-C3-XS.git] / t / 23_multi_init.t
CommitLineData
8995e827 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 2;
7
8BEGIN {
9 use_ok('Class::C3');
10}
11
12=pod
13
14rt.cpan.org # 21558
15
16If compile-time code from another module issues a [re]initialize() part-way
17through the process of setting up own our modules, that shouldn't prevent
18our 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
48Class::C3::initialize;
49is(TestMRO::D->new->testmethod, 43, 'double-initialize works ok');