X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Fi386%2Flibperl-critic-perl%2Flibperl-critic-perl-1.088%2Ft%2FVariables%2FProhibitConditionalDeclarations.run;fp=dev%2Fi386%2Flibperl-critic-perl%2Flibperl-critic-perl-1.088%2Ft%2FVariables%2FProhibitConditionalDeclarations.run;h=6a661053bcd0e406bb8a86f3ea4cf2c8460281a1;hp=0000000000000000000000000000000000000000;hb=da95c414033799c3a62606f299c3c00b5c77ca11;hpb=2d38e14bacbb15b98e539843a40b3c52a225f493 diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/ProhibitConditionalDeclarations.run b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/ProhibitConditionalDeclarations.run new file mode 100644 index 0000000..6a66105 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/Variables/ProhibitConditionalDeclarations.run @@ -0,0 +1,106 @@ +## name With if +## failures 4 +## cut + +my $foo = 1 if $bar; +our $foo = 1 if $bar; + +my ($foo, $baz) = @list if $bar; +our ($foo, $baz) = 1 if $bar; + + +#----------------------------------------------------------------------------- + +## name With unless +## failures 4 +## cut + +my $foo = 1 unless $bar; +our $foo = 1 unless $bar; + +my ($foo, $baz) = @list unless $bar; +our ($foo, $baz) = 1 unless $bar; + + +#----------------------------------------------------------------------------- + +## name With while +## failures 4 +## cut + +my $foo = 1 while $bar; +our $foo = 1 while $bar; + +my ($foo, $baz) = @list while $bar; +our ($foo, $baz) = 1 while $bar; + +#----------------------------------------------------------------------------- + +## name With for +## failures 4 +## cut + +my $foo = 1 for @bar; +our $foo = 1 for @bar; + +my ($foo, $baz) = @list for @bar; +our ($foo, $baz) = 1 for @bar; + +#----------------------------------------------------------------------------- + +## name With foreach +## failures 4 +## cut + +my $foo = 1 foreach @bar; +our $foo = 1 foreach @bar; + +my ($foo, $baz) = @list foreach @bar; +our ($foo, $baz) = 1 foreach @bar; + +#----------------------------------------------------------------------------- + +## name Passing cases +## failures 0 +## cut + +for my $foo (@list) { do_something() } +foreach my $foo (@list) { do_something() } +while (my $foo $condition) { do_something() } +until (my $foo = $condition) { do_something() } +unless (my $foo = $condition) { do_something() } + +# these are terrible uses of "if" but do not violate the policy +my $foo = $hash{if}; +my $foo = $obj->if(); + +#----------------------------------------------------------------------------- + +## name local is exempt +## failures 0 +## cut + +local $foo = $bar if $baz; +local ($foo) = $bar if $baz; +local $foo = $bar unless $baz; +local ($foo) = $bar unless $baz; +local $foo = $bar until $baz; +local ($foo) = $bar until $baz; +local ($foo, $bar) = 1 foreach @baz; +local ($foo, $bar) = 1 for @baz; + +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/Variables/ProhibitConditionalDeclarations.run $ +# $Date: 2008-03-16 17:40:45 -0500 (Sun, 16 Mar 2008) $ +# $Author: clonezone $ +# $Revision: 2187 $ +############################################################################## + +# 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 :