move pod tests to xt
[gitmo/Algorithm-C3.git] / t / 005_order_disagreement.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 2;
7
8 BEGIN {
9     use_ok('Algorithm::C3');
10 }
11
12 =pod
13
14 This example is take from: http://www.python.org/2.3/mro.html
15
16 "Serious order disagreement" # From Guido
17 class O: pass
18 class X(O): pass
19 class Y(O): pass
20 class A(X,Y): pass
21 class B(Y,X): pass
22 try:
23     class Z(A,B): pass #creates Z(A,B) in Python 2.2
24 except 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
44 eval { 
45     Algorithm::C3::merge('Z' => sub {
46         no strict 'refs';
47         @{$_[0] . '::ISA'};
48     }) 
49 };
50 like($@, qr/^Inconsistent hierarchy/, '... got the right error with an inconsistent hierarchy');