Modified source files and compiled any and armel versions of packages
[pkg-perl] / deb-src / libperl-critic-perl / libperl-critic-perl-1.088 / t / BuiltinFunctions / ProhibitBooleanGrep.run
1 ## name Basic passing
2 ## failures 0
3 ## cut
4
5 print grep("$foo", @list);
6 print ( grep "$foo", @list );
7 @list = ( grep "$foo", @list );
8 $aref = [ grep "$foo", @list ];
9 $href = { grep "$foo", @list };
10
11 #-----------------------------------------------------------------------------
12
13 ## name Counting is allowed
14 ## failures 0
15 ## cut
16
17 $count = grep {m/./xms} @list
18
19 #-----------------------------------------------------------------------------
20
21 ## name Non-boolean in conditional
22 ## failures 0
23 ## cut
24
25 if (0 == grep {m/./xms} @list) {}
26
27 #-----------------------------------------------------------------------------
28
29 ## name For loop is not conditional
30 ## failures 0
31 ## cut
32
33 for( grep { foo($_) } @list ) {}
34 foreach( grep { foo($_) } @list ) {}
35
36 #-----------------------------------------------------------------------------
37
38 ## name Control structures
39 ## failures 4
40 ## cut
41
42 if( grep { foo($_) } @list ) {}
43 unless( grep { foo($_) } @list ) {}
44 while( grep { foo($_) } @list ) {}
45 until( grep { foo($_) } @list ) {}
46
47 #-----------------------------------------------------------------------------
48
49 ## name Postfix control structures
50 ## failures 4
51 ## cut
52
53 foo() if grep { bar($_) } @list;
54 foo() unless grep { bar($_) } @list;
55 foo() while grep { bar($_) } @list;
56 foo() until grep { bar($_) } @list;
57
58 #-----------------------------------------------------------------------------
59
60 ## name Complex booleans
61 ## failures 1
62 ## cut
63
64 if( 1 && grep { foo($_) } @list ) {}
65
66 #-----------------------------------------------------------------------------
67
68 ## name Complex booleans
69 ## failures 1
70 ## TODO need to detect assignment
71 ## cut
72
73 $bar = grep({foo()} @list) && 1;
74
75 #-----------------------------------------------------------------------------
76
77 ## name Complex booleans
78 ## failures 0
79 ## cut
80
81 1 && grep({foo()} @list) == 0;
82
83 #-----------------------------------------------------------------------------
84
85 ## name Complex booleans
86 ## failures 1
87 ## cut
88
89 1 && grep({foo()} @list) && 0;
90
91 #-----------------------------------------------------------------------------
92
93 ## name Complex booleans
94 ## failures 1
95 ## TODO detect end of statement
96 ## cut
97
98 1 && grep({foo()} @list);
99
100 #-----------------------------------------------------------------------------
101
102 ## name Complex booleans
103 ## failures 1
104 ## cut
105
106 (1 && grep({foo()} @list))
107
108 #-----------------------------------------------------------------------------
109
110 ## name code coverage...
111 ## failures 1
112 ## cut
113
114 (1 && grep);
115
116 #-----------------------------------------------------------------------------
117
118 ## name code coverage...
119 ## failures 0
120 ## cut
121
122 $hash->{grep};
123
124 #-----------------------------------------------------------------------------
125
126 ##############################################################################
127 #      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/BuiltinFunctions/ProhibitBooleanGrep.run $
128 #     $Date: 2008-03-16 17:40:45 -0500 (Sun, 16 Mar 2008) $
129 #   $Author: clonezone $
130 # $Revision: 2187 $
131 ##############################################################################
132
133 # Local Variables:
134 #   mode: cperl
135 #   cperl-indent-level: 4
136 #   fill-column: 78
137 #   indent-tabs-mode: nil
138 #   c-indentation-style: bsd
139 # End:
140 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :