Test uri_for with path = 0
[catagits/Catalyst-Runtime.git] / t / aggregate / c3_mro.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 require Catalyst;
6 require Module::Pluggable::Object;
7 use MRO::Compat;
8
9 # Get a list of all Catalyst:: packages in blib via M::P::O
10 my @cat_mods;
11 {
12   # problem with @INC on win32, see:
13   # http://rt.cpan.org/Ticket/Display.html?id=26452
14   if ($^O eq 'MSWin32') { require Win32; Win32::GetCwd(); }
15
16   local @INC = grep {/blib/} @INC;
17   @cat_mods = (
18     'Catalyst',
19     Module::Pluggable::Object->new(search_path => ['Catalyst'])->plugins,
20   );
21 }
22
23 # plan one test per found package name
24 plan tests => scalar @cat_mods;
25
26 # Try to calculate the C3 MRO for each package
27 #
28 # In the case that the initial require fails (as in
29 # Catalyst::Engine::FastCGI when FCGI is not installed),
30 # the calculateMRO eval will not error out, which is
31 # effectively a test skip.
32 #
33 foreach my $cat_mod (@cat_mods) {
34   eval " require $cat_mod ";
35   eval { mro::get_linear_isa($cat_mod, 'c3') };
36   ok(!$@, "calculateMRO for $cat_mod: $@");
37 }
38