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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#!perl
##############################################################################
# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/20_policy_prohibittrailingwhitespace.t $
# $Date: 2008-06-06 00:48:04 -0500 (Fri, 06 Jun 2008) $
# $Author: clonezone $
# $Revision: 2416 $
##############################################################################
use 5.006001;
use strict;
use warnings;
use Test::More tests => 2;
use Perl::Critic::Utils qw( :characters );
use Perl::Critic::TestUtils qw( pcritique );
Perl::Critic::TestUtils::block_perlcriticrc();
# This specific policy is being tested without 20_policies.t because the .run file
# would have to contain invisible characters.
my $code;
my $policy = 'CodeLayout::ProhibitTrailingWhitespace';
my %config;
my @violations;
my $violation_line_number;
my $violation_column_number;
#-----------------------------------------------------------------------------
$code = <<"END_PERL";
say${SPACE}"\tblurp\t";\t
say${SPACE}"${SPACE}blorp${SPACE}";${SPACE}
\f
chomp;\t${SPACE}${SPACE}
chomp;${SPACE}${SPACE}\t
END_PERL
is ( pcritique($policy, \$code), 5, $policy );
#-----------------------------------------------------------------------------
$code = <<"END_PERL";
sub${SPACE}do_frobnication${SPACE}\{
\tfor${SPACE}(${SPACE}is_frobnicating()${SPACE})${SPACE}\{
${SPACE}${SPACE}${SPACE}${SPACE}frobnicate();
\l}
}
END_PERL
is( pcritique($policy, \$code), 0, $policy );
#-----------------------------------------------------------------------------
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 78
# indent-tabs-mode: nil
# c-indentation-style: bsd
# End:
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :
|