File: c3_mro.t

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (38 lines) | stat: -rw-r--r-- 959 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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: $@");
}