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%2FValuesAndExpressions%2FProhibitCommaSeparatedStatements.run;fp=dev%2Fi386%2Flibperl-critic-perl%2Flibperl-critic-perl-1.088%2Ft%2FValuesAndExpressions%2FProhibitCommaSeparatedStatements.run;h=bb5a66f7009634f8e6e6f3dbad3840ce03785178;hp=0000000000000000000000000000000000000000;hb=da95c414033799c3a62606f299c3c00b5c77ca11;hpb=2d38e14bacbb15b98e539843a40b3c52a225f493 diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitCommaSeparatedStatements.run b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitCommaSeparatedStatements.run new file mode 100644 index 0000000..bb5a66f --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ValuesAndExpressions/ProhibitCommaSeparatedStatements.run @@ -0,0 +1,283 @@ +## name Basic passing +## failures 0 +## cut + +@x = (@y, @z); +my $expl = [133, 138]; +$lookup = { a => 1, b => 2 }; + +#----------------------------------------------------------------------------- + +## name Basic failure +## failures 1 +## cut + +@x = @y, @z; + +#----------------------------------------------------------------------------- + +## name List including assignments +## failures 0 +## cut + +@w = ($x = 1, $y = 2, $z = 3); + +#----------------------------------------------------------------------------- + +## name List containing statement +## failures 0 +## cut + +@w = ( {}, [] ); + +#----------------------------------------------------------------------------- + +## name List containing statement in a constructor that is reported as a block +## failures 0 +## cut + +my %foo = ( + blah => { + blah => 'blah', + }, +); + +#----------------------------------------------------------------------------- + +## name Regular statement inside a block. +## failures 0 +## cut + +foreach my $path ( @ARGV ) { + utter 'Looking at ', $path, '.'; +} + +#----------------------------------------------------------------------------- + +## name Sub call after comma +## failures 1 +## cut + +@x = @y, foo @z; + +#----------------------------------------------------------------------------- + +## name Regular sub call before comma +## failures 1 +## cut + +# The space between the sub name and the left parenthesis is significant +# in that part of Conway's point is that things that look like lists may +# not be. + +@x = foo (@y), @z; + +#----------------------------------------------------------------------------- + +## name No-argument sub call via use of sigil +## failures 1 +## cut + +@x = &foo, @y, bar @z; + +#----------------------------------------------------------------------------- + +## name Two sub calls +## failures 0 +## cut + +@x = foo @y, bar @z; + +#----------------------------------------------------------------------------- + +## name Built-in call that provides a list context without parentheses +## failures 0 +## cut + +@x = push @y, @z; + +#----------------------------------------------------------------------------- + +## name Built-in call that provides a list context, called like a function +## failures 1 +## cut + +@x = push (@y), @z; + +#----------------------------------------------------------------------------- + +## name Built-in call that takes multiple arguments without parentheses +## failures 0 +## cut + +@x = substr $y, 1, 2; + +#----------------------------------------------------------------------------- + +## name Built-in call that takes multiple arguments, called like a function +## failures 1 +## cut + +@x = substr ($y, 1), 2; + +#----------------------------------------------------------------------------- + +## name Call to unary built-in without parentheses +## failures 1 +## cut + +@x = tied @y, @z; + +#----------------------------------------------------------------------------- + +## name Unary built-in, called like a function +## failures 1 +## cut + +@x = tied (@y), @z; + +#----------------------------------------------------------------------------- + +## name Call to no-argument built-in without parentheses +## failures 1 +## cut + +@x = time, @z; + +#----------------------------------------------------------------------------- + +## name No-argument built-in, called like a function +## failures 1 +## cut + +@x = time (), @z; + +#----------------------------------------------------------------------------- + +## name Call to optional argument built-in without an argument without parentheses +## failures 1 +## cut + +@x = sin, @z; + +#----------------------------------------------------------------------------- + +## name Optional argument built-in, called like a function without an argument +## failures 1 +## cut + +@x = sin (), @z; + +#----------------------------------------------------------------------------- + +## name Call to optional argument built-in with an argument without parentheses +## failures 1 +## cut + +@x = sin @y, @z; + +#----------------------------------------------------------------------------- + +## name Optional argument built-in, called like a function with an argument +## failures 1 +## cut + +@x = sin (@y), @z; + +#----------------------------------------------------------------------------- + +## name For loop +## failures 2 +## cut + +for ($x = 0, $y = 0; $x < 10; $x++, $y += 2) { + foo($x, $y); +} + +#----------------------------------------------------------------------------- + +## name For loop +## failures 0 +## cut + +for ($x, 'x', @y, 1, ) { + print; +} + +#----------------------------------------------------------------------------- + +## name qw<> +## failures 0 +## cut + +@list = qw<1, 2, 3>; # this really means @list = ('1,', '2,', '3'); + +#----------------------------------------------------------------------------- + +## name original RT #27654 +## failures 0 +## cut + +my @arr1; +@arr1 = split /b/, 'abc'; + +#----------------------------------------------------------------------------- + +## name RT #27654 - NKH example 1 +## failures 0 +## TODO PPI parses this code as a block and not a hash constructor. +## cut + +return + { + "string" => $aliased_history, + TIME => $self->{something}, + } ; + +#----------------------------------------------------------------------------- + +## name RT #27654 - NKH example 2 - without allow_last_statement_to_be_comma_separated_in_map_and_grep +## failures 1 +## cut + +%hash = map {$_, 1} @list ; + +#----------------------------------------------------------------------------- + +## name RT #27654 - NKH example 2 - with allow_last_statement_to_be_comma_separated_in_map_and_grep +## failures 0 +## parms { allow_last_statement_to_be_comma_separated_in_map_and_grep => 1 } +## cut + +%hash = map {$_, 1} @list ; + +#----------------------------------------------------------------------------- + +## name RT #27654 - NKH example 3 +## failures 0 +## TODO PPI parses this code as blocks and not hash constructors. +## cut + +$self->DoSomething + ( + { %{$a_hash_ref}, %{$another_hash_ref}}, + @more_data, + ) ; + +#----------------------------------------------------------------------------- + +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/ValuesAndExpressions/ProhibitCommaSeparatedStatements.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 :