Modified source files and compiled any and armel versions of packages
[pkg-perl] / deb-src / libperl-critic-perl / libperl-critic-perl-1.088 / t / ValuesAndExpressions / ProhibitCommaSeparatedStatements.run
1 ## name Basic passing
2 ## failures 0
3 ## cut
4
5 @x = (@y, @z);
6 my $expl = [133, 138];
7 $lookup = { a => 1, b => 2 };
8
9 #-----------------------------------------------------------------------------
10
11 ## name Basic failure
12 ## failures 1
13 ## cut
14
15 @x = @y, @z;
16
17 #-----------------------------------------------------------------------------
18
19 ## name List including assignments
20 ## failures 0
21 ## cut
22
23 @w = ($x = 1, $y = 2, $z = 3);
24
25 #-----------------------------------------------------------------------------
26
27 ## name List containing statement
28 ## failures 0
29 ## cut
30
31 @w = ( {}, [] );
32
33 #-----------------------------------------------------------------------------
34
35 ## name List containing statement in a constructor that is reported as a block
36 ## failures 0
37 ## cut
38
39 my %foo = (
40     blah => {
41         blah => 'blah',
42     },
43 );
44
45 #-----------------------------------------------------------------------------
46
47 ## name Regular statement inside a block.
48 ## failures 0
49 ## cut
50
51 foreach my $path ( @ARGV ) {
52     utter 'Looking at ', $path, '.';
53 }
54
55 #-----------------------------------------------------------------------------
56
57 ## name Sub call after comma
58 ## failures 1
59 ## cut
60
61 @x = @y, foo @z;
62
63 #-----------------------------------------------------------------------------
64
65 ## name Regular sub call before comma
66 ## failures 1
67 ## cut
68
69 # The space between the sub name and the left parenthesis is significant
70 # in that part of Conway's point is that things that look like lists may
71 # not be.
72
73 @x = foo (@y), @z;
74
75 #-----------------------------------------------------------------------------
76
77 ## name No-argument sub call via use of sigil
78 ## failures 1
79 ## cut
80
81 @x = &foo, @y, bar @z;
82
83 #-----------------------------------------------------------------------------
84
85 ## name Two sub calls
86 ## failures 0
87 ## cut
88
89 @x = foo @y, bar @z;
90
91 #-----------------------------------------------------------------------------
92
93 ## name Built-in call that provides a list context without parentheses
94 ## failures 0
95 ## cut
96
97 @x = push @y, @z;
98
99 #-----------------------------------------------------------------------------
100
101 ## name Built-in call that provides a list context, called like a function
102 ## failures 1
103 ## cut
104
105 @x = push (@y), @z;
106
107 #-----------------------------------------------------------------------------
108
109 ## name Built-in call that takes multiple arguments without parentheses
110 ## failures 0
111 ## cut
112
113 @x = substr $y, 1, 2;
114
115 #-----------------------------------------------------------------------------
116
117 ## name Built-in call that takes multiple arguments, called like a function
118 ## failures 1
119 ## cut
120
121 @x = substr ($y, 1), 2;
122
123 #-----------------------------------------------------------------------------
124
125 ## name Call to unary built-in without parentheses
126 ## failures 1
127 ## cut
128
129 @x = tied @y, @z;
130
131 #-----------------------------------------------------------------------------
132
133 ## name Unary built-in, called like a function
134 ## failures 1
135 ## cut
136
137 @x = tied (@y), @z;
138
139 #-----------------------------------------------------------------------------
140
141 ## name Call to no-argument built-in without parentheses
142 ## failures 1
143 ## cut
144
145 @x = time, @z;
146
147 #-----------------------------------------------------------------------------
148
149 ## name No-argument built-in, called like a function
150 ## failures 1
151 ## cut
152
153 @x = time (), @z;
154
155 #-----------------------------------------------------------------------------
156
157 ## name Call to optional argument built-in without an argument without parentheses
158 ## failures 1
159 ## cut
160
161 @x = sin, @z;
162
163 #-----------------------------------------------------------------------------
164
165 ## name Optional argument built-in, called like a function without an argument
166 ## failures 1
167 ## cut
168
169 @x = sin (), @z;
170
171 #-----------------------------------------------------------------------------
172
173 ## name Call to optional argument built-in with an argument without parentheses
174 ## failures 1
175 ## cut
176
177 @x = sin @y, @z;
178
179 #-----------------------------------------------------------------------------
180
181 ## name Optional argument built-in, called like a function with an argument
182 ## failures 1
183 ## cut
184
185 @x = sin (@y), @z;
186
187 #-----------------------------------------------------------------------------
188
189 ## name For loop
190 ## failures 2
191 ## cut
192
193 for ($x = 0, $y = 0; $x < 10; $x++, $y += 2) {
194     foo($x, $y);
195 }
196
197 #-----------------------------------------------------------------------------
198
199 ## name For loop
200 ## failures 0
201 ## cut
202
203 for ($x, 'x', @y, 1, ) {
204     print;
205 }
206
207 #-----------------------------------------------------------------------------
208
209 ## name qw<>
210 ## failures 0
211 ## cut
212
213 @list = qw<1, 2, 3>; # this really means @list = ('1,', '2,', '3');
214
215 #-----------------------------------------------------------------------------
216
217 ## name original RT #27654
218 ## failures 0
219 ## cut
220
221 my @arr1;
222 @arr1 = split /b/, 'abc';
223
224 #-----------------------------------------------------------------------------
225
226 ## name RT #27654 - NKH example 1
227 ## failures 0
228 ## TODO PPI parses this code as a block and not a hash constructor.
229 ## cut
230
231 return
232   {
233   "string" => $aliased_history,
234   TIME => $self->{something},
235   } ;
236
237 #-----------------------------------------------------------------------------
238
239 ## name RT #27654 - NKH example 2 - without allow_last_statement_to_be_comma_separated_in_map_and_grep
240 ## failures 1
241 ## cut
242
243 %hash = map {$_, 1} @list ;
244
245 #-----------------------------------------------------------------------------
246
247 ## name RT #27654 - NKH example 2 - with allow_last_statement_to_be_comma_separated_in_map_and_grep
248 ## failures 0
249 ## parms { allow_last_statement_to_be_comma_separated_in_map_and_grep => 1 }
250 ## cut
251
252 %hash = map {$_, 1} @list ;
253
254 #-----------------------------------------------------------------------------
255
256 ## name RT #27654 - NKH example 3
257 ## failures 0
258 ## TODO PPI parses this code as blocks and not hash constructors.
259 ## cut
260
261 $self->DoSomething
262   (
263   { %{$a_hash_ref}, %{$another_hash_ref}},
264   @more_data,
265   ) ;
266
267 #-----------------------------------------------------------------------------
268
269 ##############################################################################
270 #      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/ValuesAndExpressions/ProhibitCommaSeparatedStatements.run $
271 #     $Date: 2008-03-16 17:40:45 -0500 (Sun, 16 Mar 2008) $
272 #   $Author: clonezone $
273 # $Revision: 2187 $
274 ##############################################################################
275
276 # Local Variables:
277 #   mode: cperl
278 #   cperl-indent-level: 4
279 #   fill-column: 78
280 #   indent-tabs-mode: nil
281 #   c-indentation-style: bsd
282 # End:
283 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :