Merge 'trunk' into 'replication_dedux'
[dbsrgits/DBIx-Class.git] / t / 04dont_break_c3.t
CommitLineData
e4c24739 1#!/usr/bin/perl -w
2#Simon Ilyushchenko, 12/05/05
3#Testing the case when we try to inject into @ISA a class that's already a parent of the target class.
4
5use strict;
6use Test::More tests => 2;
7
8{
9package AAA;
10
11use base "DBIx::Class::Core";
12
13package BBB;
14
15use base 'AAA';
16
17#Injecting a direct parent.
18__PACKAGE__->inject_base( __PACKAGE__, 'AAA' );
19
20
21package CCC;
22
23use base 'AAA';
24
25#Injecting an indirect parent.
26__PACKAGE__->inject_base( __PACKAGE__, 'DBIx::Class::Core' );
27}
28
29eval { Class::C3::calculateMRO('BBB'); };
30ok (! $@, "Correctly skipped injecting a direct parent of class BBB");
31
32eval { Class::C3::calculateMRO('CCC'); };
33ok (! $@, "Correctly skipped injecting an indirect parent of class BBB");