> ext/mro/mro.xs: mro_get_linear_isa_c3: Inconsistent hierarchy during C3
> merge of class ...
Ooooh, that doesn't seem to be tested anywhere. Fortunately Class::C3 on
CPAN seems to have a test that that we can "borrow". I mean imitate.
Imitation being the sincerest form of flattery.
(Assuming that you haven't written one between then and now. Likely this
belongs somewhere in ext/mro/t/)
Nicholas Clark
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 1;
=pod
This example is take from: http://www.python.org/2.3/mro.html
"Serious order disagreement" # From Guido
class O: pass
class X(O): pass
class Y(O): pass
class A(X,Y): pass
class B(Y,X): pass
try:
class Z(A,B): pass #creates Z(A,B) in Python 2.2
except TypeError:
pass # Z(A,B) cannot be created in Python 2.3
Perl by rafl in the Class::C3 test suite, adapted for the core to use 'c3',
and switch from base to parent.
=cut
eval q{
package X;
use mro 'c3';
package Y;
use mro 'c3';
package XY;
use mro 'c3';
use parent ('-norequire', 'X', 'Y');
package YX;
use mro 'c3';
use parent ('-norequire', 'Y', 'X');
package Z;
use mro 'c3';
use parent ('-norequire', 'XY', 'YX');
};
like($@, qr/Inconsistent hierarchy during C3 merge of class 'Z'/,
'... got the right error with an inconsistent hierarchy');
Ooooh, that doesn't seem to be tested anywhere. Fortunately Class::C3 on
CPAN seems to have a test that that we can "borrow". I mean imitate.
Imitation being the sincerest form of flattery.
(Assuming that you haven't written one between then and now. Likely this
belongs somewhere in ext/mro/t/)