Modified source files and compiled any and armel versions of packages
[pkg-perl] / deb-src / libperl-critic-perl / libperl-critic-perl-1.088 / t / 12_policylisting.t
1 #!perl
2
3 ##############################################################################
4 #     $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/12_policylisting.t $
5 #    $Date: 2008-06-06 00:48:04 -0500 (Fri, 06 Jun 2008) $
6 #   $Author: clonezone $
7 # $Revision: 2416 $
8 ##############################################################################
9
10 use 5.006001;
11 use strict;
12 use warnings;
13
14 use English qw<-no_match_vars>;
15
16 use Test::More;
17
18 use Perl::Critic::UserProfile;
19 use Perl::Critic::PolicyFactory (-test => 1);
20 use Perl::Critic::PolicyListing;
21
22 #-----------------------------------------------------------------------------
23
24 my $profile = Perl::Critic::UserProfile->new( -profile => 'NONE' );
25 my @policy_names = Perl::Critic::PolicyFactory::site_policy_names();
26 my $factory = Perl::Critic::PolicyFactory->new( -profile => $profile );
27 my @policies = map { $factory->create_policy( -name => $_ ) } @policy_names;
28 my $listing = Perl::Critic::PolicyListing->new( -policies => \@policies );
29 my $policy_count = scalar @policies;
30
31 plan( tests => $policy_count + 1);
32
33 #-----------------------------------------------------------------------------
34 # These tests verify that the listing has the right number of lines (one per
35 # policy) and that each line matches the expected pattern.  This indirectly
36 # verifies that each core policy declares at least one theme.
37
38 my $listing_as_string = "$listing";
39 my @listing_lines = split /\n/, $listing_as_string;
40 my $line_count = scalar @listing_lines;
41 is( $line_count, $policy_count, qq{Listing has all $policy_count policies} );
42
43
44 my $listing_pattern = qr{\A\d [\w:]+ \[[\w\s]+\]\z};
45 for my $line ( @listing_lines ) {
46     like($line, $listing_pattern, 'Listing format matches expected pattern');
47 }
48
49 #-----------------------------------------------------------------------------
50
51 # ensure we run true if this test is loaded by
52 # t/12_policylisting.t_without_optional_dependencies.t
53 1;
54
55 #-----------------------------------------------------------------------------
56 # Local Variables:
57 #   mode: cperl
58 #   cperl-indent-level: 4
59 #   fill-column: 78
60 #   indent-tabs-mode: nil
61 #   c-indentation-style: bsd
62 # End:
63 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :