X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=trunk%2Ft%2Faggregate%2Fc3_mro.t;fp=trunk%2Ft%2Faggregate%2Fc3_mro.t;h=99057c8b8c75d37ec0c0ec32ec90af2ffe9f3148;hb=e28a6876ad3e11890226e5bab6df4b0725e0981e;hp=0000000000000000000000000000000000000000;hpb=21c94d83082b43028cafcfb18659090b13d832fa;p=catagits%2FCatalyst-Runtime.git diff --git a/trunk/t/aggregate/c3_mro.t b/trunk/t/aggregate/c3_mro.t new file mode 100644 index 0000000..99057c8 --- /dev/null +++ b/trunk/t/aggregate/c3_mro.t @@ -0,0 +1,38 @@ +use strict; +use warnings; + +use Test::More; +require Catalyst; +require Module::Pluggable::Object; +use MRO::Compat; + +# Get a list of all Catalyst:: packages in blib via M::P::O +my @cat_mods; +{ + # problem with @INC on win32, see: + # http://rt.cpan.org/Ticket/Display.html?id=26452 + if ($^O eq 'MSWin32') { require Win32; Win32::GetCwd(); } + + local @INC = grep {/blib/} @INC; + @cat_mods = ( + 'Catalyst', + Module::Pluggable::Object->new(search_path => ['Catalyst'])->plugins, + ); +} + +# plan one test per found package name +plan tests => scalar @cat_mods; + +# Try to calculate the C3 MRO for each package +# +# In the case that the initial require fails (as in +# Catalyst::Engine::FastCGI when FCGI is not installed), +# the calculateMRO eval will not error out, which is +# effectively a test skip. +# +foreach my $cat_mod (@cat_mods) { + eval " require $cat_mod "; + eval { mro::get_linear_isa($cat_mod, 'c3') }; + ok(!$@, "calculateMRO for $cat_mod: $@"); +} +