remove extraneous garbage from tests
[gitmo/Class-C3.git] / t / 10_Inconsistent_hierarchy.t
CommitLineData
d401eda1 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
ef29cd70 6use Test::More tests => 1;
d401eda1 7
8=pod
9
10This example is take from: http://www.python.org/2.3/mro.html
11
12"Serious order disagreement" # From Guido
13class O: pass
14class X(O): pass
15class Y(O): pass
16class A(X,Y): pass
17class B(Y,X): pass
18try:
19 class Z(A,B): pass #creates Z(A,B) in Python 2.2
20except TypeError:
21 pass # Z(A,B) cannot be created in Python 2.3
22
23=cut
24
8fca9ed2 25eval q{
26 {
27 package X;
28 use Class::C3;
29
30 package Y;
31 use Class::C3;
32
33 package XY;
34 use Class::C3;
35 use base ('X', 'Y');
36
37 package YX;
38 use Class::C3;
39 use base ('Y', 'X');
40
41 package Z;
42 eval 'use Class::C3' if $Class::C3::C3_IN_CORE;
43 use base ('XY', 'YX');
44 }
d401eda1 45
8fca9ed2 46 Class::C3::initialize();
2ffffc6d 47
d401eda1 48 # now try to calculate the MRO
49 # and watch it explode :)
8fca9ed2 50 Class::C3::calculateMRO('Z');
d401eda1 51};
4e47d2a4 52#diag $@;
8fca9ed2 53like($@, qr/Inconsistent hierarchy /, '... got the right error with an inconsistent hierarchy');