This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: new C3 MRO patch
[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
12use Test::More tests => 1;
13
14=pod
15
16This example is take from: http://www.python.org/2.3/mro.html
17
18"Serious order disagreement" # From Guido
19class O: pass
20class X(O): pass
21class Y(O): pass
22class A(X,Y): pass
23class B(Y,X): pass
24try:
25 class Z(A,B): pass #creates Z(A,B) in Python 2.2
26except TypeError:
27 pass # Z(A,B) cannot be created in Python 2.3
28
29=cut
30
31{
32 package X;
33
34 package Y;
35
36 package XY;
37 our @ISA = ('X', 'Y');
38
39 package YX;
40 our @ISA = ('Y', 'X');
41
42 package Z;
43 our @ISA = ('XY', 'YX');
44}
45
46eval { mro::get_linear_isa('Z', 'c3') };
47like($@, qr/^Inconsistent /, '... got the right error with an inconsistent hierarchy');