Login
Implement ValuesAndExpressions::ProhibitCommaSeparatedStatements
[gknop/Perl-Critic.git] / t / ValuesAndExpressions / ProhibitCommaSeparatedStatements.run
CommitLineData
c948abe5
ES
1## name Basic passing
2## failures 0
3## cut
4
5@x = (@y, @z);
6my $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
39my %foo = (
40 blah => {
41 blah => 'blah',
42 },
43);
44
45#-----------------------------------------------------------------------------
46
47## name Regular statement inside a block.
48## failures 1
49## cut
50
51foreach my $path ( @ARGV ) {
52 say '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@x = foo(@y), @z;
70
71#-----------------------------------------------------------------------------
72
73## name No-argument sub call via use of sigil
74## failures 1
75## cut
76
77@x = &foo, @y, bar @z;
78
79#-----------------------------------------------------------------------------
80
81## name Two sub calls
82## failures 1
83## cut
84
85@x = foo @y, bar @z;
86
87#-----------------------------------------------------------------------------
88
89## name Built-in call that provides a list context
90## failures 0
91## cut
92
93@x = push @y, @z;
94
95#-----------------------------------------------------------------------------
96
97## name Built-in call that provides a list context, called like a function
98## failures 1
99## cut
100
101@x = push (@y), @z;
102
103#-----------------------------------------------------------------------------
104
105## name Built-in call that takes multiple arguments without parentheses
106## failures 0
107## cut
108
109$x = substr $y, 1, 2;
110
111#-----------------------------------------------------------------------------
112
113## name Built-in call that takes multiple arguments without parentheses, called like a function
114## failures 1
115## cut
116
117$x = substr ($y, 1), 2;
118
119#-----------------------------------------------------------------------------
120
121## name Call to unary built-in
122## failures 1
123## cut
124
125@x = sin @y, @z;
126
127#-----------------------------------------------------------------------------
128
129## name For loop
130## failures 2
131## cut
132
133for ($x = 0, $y = 0; $x < 10; $x++, $y += 2) {
134 foo($x, $y);
135}
136
137#-----------------------------------------------------------------------------
138
139##############################################################################
140# $URL$
141# $Date$
142# $Author$
143# $Revision$
144##############################################################################
145
146# Local Variables:
147# mode: cperl
148# cperl-indent-level: 4
149# fill-column: 78
150# indent-tabs-mode: nil
151# c-indentation-style: bsd
152# End:
153# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab :