Modified source files and compiled any and armel versions of packages
[pkg-perl] / deb-src / libperl-critic-perl / libperl-critic-perl-1.088 / t / 20_policy_prohibithardtabs.t
1 #!perl
2
3 ##############################################################################
4 #      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/20_policy_prohibithardtabs.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 use Test::More tests => 5;
14
15 # common P::C testing tools
16 use Perl::Critic::TestUtils qw(pcritique fcritique);
17 Perl::Critic::TestUtils::block_perlcriticrc();
18
19 # This specific policy is being tested without run.t because the .run file
20 # would have to contain invisible characters.
21
22 my $code;
23 my $policy = 'CodeLayout::ProhibitHardTabs';
24 my %config;
25
26 #-----------------------------------------------------------------------------
27
28 $code = <<"END_PERL";
29 #This will be interpolated!
30
31 sub my_sub {
32 \tfor(1){
33 \t\tdo_something();
34 \t}
35 }
36
37 \t\t\t;
38
39 END_PERL
40
41 is( pcritique($policy, \$code), 0, $policy );
42
43 #-----------------------------------------------------------------------------
44
45 $code = <<"END_PERL";
46 #This will be interpolated!
47 print "\t  \t  foobar  \t";
48 END_PERL
49
50 is( pcritique($policy, \$code), 1, $policy );
51
52 #-----------------------------------------------------------------------------
53
54 $code = <<"END_PERL";
55 ##This will be interpolated!
56
57 sub my_sub {
58 \tfor(1){
59 \t\tdo_something();
60 \t}
61 }
62
63 END_PERL
64
65 %config = (allow_leading_tabs => 0);
66 is( pcritique($policy, \$code, \%config), 3, $policy );
67
68 #-----------------------------------------------------------------------------
69
70 $code = <<"END_PERL";
71 ##This will be interpolated!
72
73 sub my_sub {
74 ;\tfor(1){
75 \t\tdo_something();
76 ;\t}
77 }
78
79 END_PERL
80
81 %config = (allow_leading_tabs => 0);
82 is( pcritique($policy, \$code, \%config), 3, $policy );
83
84 #-----------------------------------------------------------------------------
85
86 $code = <<"END_PERL";
87 #This will be interpolated!
88
89 __DATA__
90 foo\tbar\tbaz
91 \tfred\barney
92
93 END_PERL
94
95 %config = (allow_leading_tabs => 0);
96 is( pcritique($policy, \$code, \%config), 0, 'Tabs in __DATA__' );
97
98 #-----------------------------------------------------------------------------
99
100 # Local Variables:
101 #   mode: cperl
102 #   cperl-indent-level: 4
103 #   fill-column: 78
104 #   indent-tabs-mode: nil
105 #   c-indentation-style: bsd
106 # End:
107 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :