This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Create a block around some code; indent
[perl5.git] / t / mro / inconsistent_c3.t
CommitLineData
e1a479c5
BB
1#!./perl
2
e1a479c5
BB
3BEGIN {
4 unless (-d 'blib') {
5 chdir 't' if -d 't';
e1a479c5 6 }
624c42e2
N
7 require q(./test.pl);
8 set_up_inc('../lib');
e1a479c5
BB
9}
10
0b1b7115
JH
11use strict;
12use warnings;
13
624c42e2 14plan(tests => 1);
e1a479c5 15
b2685f0c
NC
16require mro;
17
e1a479c5
BB
18=pod
19
20This example is take from: http://www.python.org/2.3/mro.html
21
22"Serious order disagreement" # From Guido
23class O: pass
24class X(O): pass
25class Y(O): pass
26class A(X,Y): pass
27class B(Y,X): pass
28try:
29 class Z(A,B): pass #creates Z(A,B) in Python 2.2
30except TypeError:
31 pass # Z(A,B) cannot be created in Python 2.3
32
33=cut
34
35{
36 package X;
37
38 package Y;
39
40 package XY;
41 our @ISA = ('X', 'Y');
42
43 package YX;
44 our @ISA = ('Y', 'X');
45
46 package Z;
47 our @ISA = ('XY', 'YX');
48}
49
50eval { mro::get_linear_isa('Z', 'c3') };
c3e4944b
NC
51like($@, qr/^Inconsistent hierarchy during C3 merge of class 'Z'/,
52 '... got the right error with an inconsistent hierarchy');