remove extraneous garbage from tests
[gitmo/Class-C3.git] / t / 23_multi_init.t
CommitLineData
ff168601 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
ef29cd70 6use Test::More tests => 1;
ff168601 7
8=pod
9
10rt.cpan.org # 21558
11
12If compile-time code from another module issues a [re]initialize() part-way
13through the process of setting up own our modules, that shouldn't prevent
14our 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
44Class::C3::initialize;
45is(TestMRO::D->new->testmethod, 43, 'double-initialize works ok');