avoid needing . in @INC in dev mode
[gitmo/Algorithm-C3.git] / t / 005_order_disagreement.t
CommitLineData
c0b91998 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 2;
7
8BEGIN {
9 use_ok('Algorithm::C3');
10}
11
12=pod
13
14This example is take from: http://www.python.org/2.3/mro.html
15
16"Serious order disagreement" # From Guido
17class O: pass
18class X(O): pass
19class Y(O): pass
20class A(X,Y): pass
21class B(Y,X): pass
22try:
23 class Z(A,B): pass #creates Z(A,B) in Python 2.2
24except TypeError:
25 pass # Z(A,B) cannot be created in Python 2.3
26
27=cut
28
29{
30 package X;
31
32 package Y;
33
34 package XY;
35 our @ISA = ('X', 'Y');
36
37 package YX;
38 our @ISA = ('Y', 'X');
39
40 package Z;
41 our @ISA = ('XY', 'YX');
42}
43
44eval {
45 Algorithm::C3::merge('Z' => sub {
46 no strict 'refs';
47 @{$_[0] . '::ISA'};
48 })
49};
50like($@, qr/^Inconsistent hierarchy/, '... got the right error with an inconsistent hierarchy');