X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Farm%2Flibperl-critic-perl%2Flibperl-critic-perl-1.088%2Ft%2F20_policy_prohibithardtabs.t;fp=dev%2Farm%2Flibperl-critic-perl%2Flibperl-critic-perl-1.088%2Ft%2F20_policy_prohibithardtabs.t;h=1cd7a90b388c42e52fdd2690b77ad7298a8e5e54;hp=0000000000000000000000000000000000000000;hb=f477fa73365d491991707e7ed9217b48d6994551;hpb=da95c414033799c3a62606f299c3c00b5c77ca11 diff --git a/dev/arm/libperl-critic-perl/libperl-critic-perl-1.088/t/20_policy_prohibithardtabs.t b/dev/arm/libperl-critic-perl/libperl-critic-perl-1.088/t/20_policy_prohibithardtabs.t new file mode 100644 index 0000000..1cd7a90 --- /dev/null +++ b/dev/arm/libperl-critic-perl/libperl-critic-perl-1.088/t/20_policy_prohibithardtabs.t @@ -0,0 +1,107 @@ +#!perl + +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/20_policy_prohibithardtabs.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 => 5; + +# common P::C testing tools +use Perl::Critic::TestUtils qw(pcritique fcritique); +Perl::Critic::TestUtils::block_perlcriticrc(); + +# This specific policy is being tested without run.t because the .run file +# would have to contain invisible characters. + +my $code; +my $policy = 'CodeLayout::ProhibitHardTabs'; +my %config; + +#----------------------------------------------------------------------------- + +$code = <<"END_PERL"; +#This will be interpolated! + +sub my_sub { +\tfor(1){ +\t\tdo_something(); +\t} +} + +\t\t\t; + +END_PERL + +is( pcritique($policy, \$code), 0, $policy ); + +#----------------------------------------------------------------------------- + +$code = <<"END_PERL"; +#This will be interpolated! +print "\t \t foobar \t"; +END_PERL + +is( pcritique($policy, \$code), 1, $policy ); + +#----------------------------------------------------------------------------- + +$code = <<"END_PERL"; +##This will be interpolated! + +sub my_sub { +\tfor(1){ +\t\tdo_something(); +\t} +} + +END_PERL + +%config = (allow_leading_tabs => 0); +is( pcritique($policy, \$code, \%config), 3, $policy ); + +#----------------------------------------------------------------------------- + +$code = <<"END_PERL"; +##This will be interpolated! + +sub my_sub { +;\tfor(1){ +\t\tdo_something(); +;\t} +} + +END_PERL + +%config = (allow_leading_tabs => 0); +is( pcritique($policy, \$code, \%config), 3, $policy ); + +#----------------------------------------------------------------------------- + +$code = <<"END_PERL"; +#This will be interpolated! + +__DATA__ +foo\tbar\tbaz +\tfred\barney + +END_PERL + +%config = (allow_leading_tabs => 0); +is( pcritique($policy, \$code, \%config), 0, 'Tabs in __DATA__' ); + +#----------------------------------------------------------------------------- + +# 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 :