## name Basic failure ## failures 6 ## cut open ($foo, $bar); open($foo, $bar); uc(); lc(); # These ones deliberately omit the semi-colon sub {uc()} sub {reverse()} #----------------------------------------------------------------------------- ## name Basic passing ## failures 0 ## cut open $foo, $bar; uc $foo; lc $foo; my $foo; my ($foo, $bar); our ($foo, $bar); local ($foo $bar); return ($foo, $bar); return (); my_subroutine($foo $bar); {print}; # for Devel::Cover #----------------------------------------------------------------------------- ## name Method invocation ## failures 0 ## cut my $obj = SomeClass->new(); $obj->open(); $obj->close(); $obj->prototype(); $obj->delete(); is( pcritique($policy, \$code), 0, $policy); #----------------------------------------------------------------------------- ## name Unary operators with parens, followed by a high-precedence operator ## failures 0 ## cut $foo = int( 0.5 ) + 1.5; $foo = int( 0.5 ) - 1.5; $foo = int( 0.5 ) * 1.5; $foo = int( 0.5 ) / 1.5; $foo = int( 0.5 ) ** 1.5; $foo = oct( $foo ) + 1; $foo = ord( $foo ) - 1; $foo = sin( $foo ) * 2; $foo = uc( $foo ) . $bar; $foo = lc( $foo ) . $bar; $nanosecond = int ( ($value - $epoch) * $NANOSECONDS_PER_SECOND ); #----------------------------------------------------------------------------- ## name RT #21713 ## failures 0 ## cut print substr($foo, 2, 3), "\n"; if ( unpack('V', $foo) == 2 ) { } #----------------------------------------------------------------------------- ## name Parentheses with greedy functions ## failures 0 ## cut substr join( $delim, @list), $offset, $length; print reverse( $foo, $bar, $baz), $nuts; sort map( {some_func($_)} @list1 ), @list2; #----------------------------------------------------------------------------- ## name Test cases from RT ## failures 0 ## cut chomp( my $foo = ); defined( my $child = shift @free_children ) return ( $start_time + $elapsed_hours ) % $hours_in_day; #----------------------------------------------------------------------------- ## name High-precedence operator after parentheses ## failures 0 ## cut grep( { do_something($_) }, @list ) + 3; join( $delim, @list ) . "\n"; pack( $template, $foo, $bar ) . $suffix; chown( $file1, $file2 ) || die q{Couldn't chown}; #----------------------------------------------------------------------------- ## name Low-precedence operator after parentheses ## failures 2 ## cut grep( { do_something($_) }, $foo, $bar) and do_something(); chown( $file1, $file2 ) or die q{Couldn't chown}; #----------------------------------------------------------------------------- ## name Named unary op with operator inside parenthesis (RT #46862) ## failures 0 ## cut length( $foo // $bar ); stat( $foo || $bar ); uc( $this & $that ); #----------------------------------------------------------------------------- ## name Handling sort having subroutine name as an argument ## failures 0 ## cut sort(foo(@x)); [ sort ( modules_used_in_string( $code ) ) ] #----------------------------------------------------------------------------- ## name RT 52029 - Accept parens with 'state' ## failures 0 ## cut use 5.010; state ( $foo ); #----------------------------------------------------------------------------- ############################################################################## # $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/distributions/Perl-Critic/t/CodeLayout/ProhibitParensWithBuiltins.run $ # $Date: 2010-01-19 17:44:15 -0800 (Tue, 19 Jan 2010) $ # $Author: wyant $ # $Revision: 3752 $ ############################################################################## # 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 :