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