Commit | Line | Data |
---|---|---|
204e6232 BF |
1 | #!./perl |
2 | ||
204e6232 BF |
3 | BEGIN { |
4 | unless (-d 'blib') { | |
5 | chdir 't' if -d 't'; | |
6 | @INC = '../lib'; | |
7 | } | |
8 | } | |
9 | ||
0b1b7115 JH |
10 | use strict; |
11 | use warnings; | |
12 | ||
204e6232 BF |
13 | use utf8; |
14 | use open qw( :utf8 :std ); | |
15 | ||
16 | require q(./test.pl); plan(tests => 1); | |
17 | ||
18 | require mro; | |
19 | ||
20 | =pod | |
21 | ||
22 | This example is take from: http://www.python.org/2.3/mro.html | |
23 | ||
24 | "Serious order disagreement" # From Guido | |
25 | class O: pass | |
26 | class X(O): pass | |
27 | class Y(O): pass | |
28 | class A(X,Y): pass | |
29 | class B(Y,X): pass | |
30 | try: | |
31 | class Z(A,B): pass #creates Z(A,B) in Python 2.2 | |
32 | except TypeError: | |
33 | pass # Z(A,B) cannot be created in Python 2.3 | |
34 | ||
35 | =cut | |
36 | ||
37 | { | |
38 | package ẋ; | |
39 | ||
40 | package Ƴ; | |
41 | ||
42 | package ẋƳ; | |
43 | our @ISA = ('ẋ', 'Ƴ'); | |
44 | ||
45 | package Ƴẋ; | |
46 | our @ISA = ('Ƴ', 'ẋ'); | |
47 | ||
48 | package Ȥ; | |
49 | our @ISA = ('ẋƳ', 'Ƴẋ'); | |
50 | } | |
51 | ||
52 | eval { mro::get_linear_isa('Ȥ', 'c3') }; | |
53 | like($@, qr/^Inconsistent /, '... got the right error with an inconsistent hierarchy'); |