Commit | Line | Data |
b4664174 |
1 | use strict; |
2 | use warnings; |
3 | |
4 | use Test::More; |
5 | require Catalyst; |
6 | require Module::Pluggable::Object; |
7 | |
8 | eval "require Class::C3"; |
9 | plan skip_all => "This test requires Class::C3" if $@; |
10 | |
11 | # Get a list of all Catalyst:: packages in blib via M::P::O |
12 | my @cat_mods; |
13 | { |
14 | local @INC = grep {/blib/} @INC; |
15 | @cat_mods = ( |
16 | 'Catalyst', |
17 | Module::Pluggable::Object->new(search_path => ['Catalyst'])->plugins, |
18 | ); |
19 | } |
20 | |
21 | # plan one test per found package name |
22 | plan tests => scalar @cat_mods; |
23 | |
24 | # Try to calculate the C3 MRO for each package |
25 | # |
26 | # In the case that the initial require fails (as in |
27 | # Catalyst::Engine::FastCGI when FCGI is not installed), |
28 | # the calculateMRO eval will not error out, which is |
29 | # effectively a test skip. |
30 | # |
31 | foreach my $cat_mod (@cat_mods) { |
32 | eval " require $cat_mod "; |
33 | eval { Class::C3::calculateMRO($cat_mod) }; |
34 | ok(!$@, "calculateMRO for $cat_mod"); |
35 | } |
36 | |