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