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