This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Remove useless code
[perl5.git] / t / mro / inconsistent_c3.t
1 #!./perl
2
3 use strict;
4 use warnings;
5 BEGIN {
6     unless (-d 'blib') {
7         chdir 't' if -d 't';
8         @INC = '../lib';
9     }
10 }
11
12 require q(./test.pl); plan(tests => 1);
13
14 require mro;
15
16 =pod
17
18 This example is take from: http://www.python.org/2.3/mro.html
19
20 "Serious order disagreement" # From Guido
21 class O: pass
22 class X(O): pass
23 class Y(O): pass
24 class A(X,Y): pass
25 class B(Y,X): pass
26 try:
27     class Z(A,B): pass #creates Z(A,B) in Python 2.2
28 except 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
48 eval { mro::get_linear_isa('Z', 'c3') };
49 like($@, qr/^Inconsistent hierarchy during C3 merge of class 'Z'/,
50      '... got the right error with an inconsistent hierarchy');