add missing dTHR; notes for test failures due to small stacksize
[p5sagit/p5-mst-13.2.git] / t / pragma / warn-toke
CommitLineData
599cee73 1toke.c AOK
2
3 we seem to have lost a few ambiguous warnings!!
4
5
6 1 if $a EQ $b ;
7 1 if $a NE $b ;
8 1 if $a LT $b ;
9 1 if $a GT $b ;
10 1 if $a GE $b ;
11 1 if $a LE $b ;
12 $a = <<;
13 Use of comma-less variable list is deprecated
14 (called 3 times via depcom)
15
16 \1 better written as $1
17 use warning 'syntax' ;
18 s/(abc)/\1/;
19
20 warn(warn_nosemi)
21 Semicolon seems to be missing
22 $a = 1
23 &time ;
24
25
26 Reversed %c= operator
27 my $a =+ 2 ;
28 $a =- 2 ;
29 $a =* 2 ;
30 $a =% 2 ;
31 $a =& 2 ;
32 $a =. 2 ;
33 $a =^ 2 ;
34 $a =| 2 ;
35 $a =< 2 ;
36 $a =/ 2 ;
37
38 Multidimensional syntax %.*s not supported
39 my $a = $a[1,2] ;
40
41 You need to quote \"%s\""
42 sub fred {} ; $SIG{TERM} = fred;
43
44 Scalar value %.*s better written as $%.*s"
45 @a[3] = 2;
46 @a{3} = 2;
47
48 Can't use \\%c to mean $%c in expression
49 $_ = "ab" ; s/(ab)/\1/e;
50
51 Unquoted string "abc" may clash with future reserved word at - line 3.
52 warn(warn_reserved
53 $a = abc;
54
55 chmod: mode argument is missing initial 0
56 chmod 3;
57
58 Possible attempt to separate words with commas
59 @a = qw(a, b, c) ;
60
61 Possible attempt to put comments in qw() list
62 @a = qw(a b # c) ;
63
64 umask: argument is missing initial 0
65 umask 3;
66
67 %s (...) interpreted as function
68 print ("")
69 printf ("")
70 sort ("")
71
72 Ambiguous use of %c{%s%s} resolved to %c%s%s
73 $a = ${time[2]}
74 $a = ${time{2}}
75
76
77 Ambiguous use of %c{%s} resolved to %c%s
78 $a = ${time}
79 sub fred {} $a = ${fred}
80
81 Misplaced _ in number
82 $a = 1_2;
83 $a = 1_2345_6;
84
85 Bareword \"%s\" refers to nonexistent package
86 $a = FRED:: ;
87
88 Ambiguous call resolved as CORE::%s(), qualify as such or use &
89 sub time {}
90 my $a = time()
91
92 Use of \\x{} without utf8 declaration
93 $_ = " \x{123} " ;
94
95
96 \x%.*s will produce malformed UTF-8 character; use \x{%.*s} for that
97 use utf8 ;
98 $_ = "\xffe"
99
100__END__
101# toke.c
102use warning 'deprecated' ;
1031 if $a EQ $b ;
1041 if $a NE $b ;
1051 if $a GT $b ;
1061 if $a LT $b ;
1071 if $a GE $b ;
1081 if $a LE $b ;
109EXPECT
110Use of EQ is deprecated at - line 3.
111Use of NE is deprecated at - line 4.
112Use of GT is deprecated at - line 5.
113Use of LT is deprecated at - line 6.
114Use of GE is deprecated at - line 7.
115Use of LE is deprecated at - line 8.
116########
117# toke.c
118use warning 'deprecated' ;
119format STDOUT =
120@<<< @||| @>>> @>>>
121$a $b "abc" 'def'
122.
123($a, $b) = (1,2,3);
124write;
125EXPECT
126Use of comma-less variable list is deprecated at - line 5.
127Use of comma-less variable list is deprecated at - line 5.
128Use of comma-less variable list is deprecated at - line 5.
1291 2 abc def
130########
131# toke.c
132use warning 'deprecated' ;
133$a = <<;
134
135EXPECT
136Use of bare << to mean <<"" is deprecated at - line 3.
137########
138# toke.c
139use warning 'syntax' ;
140s/(abc)/\1/;
141EXPECT
142\1 better written as $1 at - line 3.
143########
144# toke.c
145use warning 'semicolon' ;
146$a = 1
147&time ;
148EXPECT
149Semicolon seems to be missing at - line 3.
150########
151# toke.c
152use warning 'syntax' ;
153my $a =+ 2 ;
154$a =- 2 ;
155$a =* 2 ;
156$a =% 2 ;
157$a =& 2 ;
158$a =. 2 ;
159$a =^ 2 ;
160$a =| 2 ;
161$a =< 2 ;
162$a =/ 2 ;
163EXPECT
164Reversed += operator at - line 3.
165Reversed -= operator at - line 4.
166Reversed *= operator at - line 5.
167Reversed %= operator at - line 6.
168Reversed &= operator at - line 7.
169Reversed .= operator at - line 8.
170syntax error at - line 8, near "=."
171Reversed ^= operator at - line 9.
172syntax error at - line 9, near "=^"
173Reversed |= operator at - line 10.
174syntax error at - line 10, near "=|"
175Reversed <= operator at - line 11.
176Unterminated <> operator at - line 11.
177########
178# toke.c
179use warning 'syntax' ;
180my $a = $a[1,2] ;
181EXPECT
182Multidimensional syntax $a[1,2] not supported at - line 3.
183########
184# toke.c
185use warning 'syntax' ;
186sub fred {} ; $SIG{TERM} = fred;
187EXPECT
188You need to quote "fred" at - line 3.
189########
190# toke.c
191use warning 'syntax' ;
192@a[3] = 2;
193@a{3} = 2;
194EXPECT
195Scalar value @a[3] better written as $a[3] at - line 3.
196Scalar value @a{3} better written as $a{3} at - line 4.
197########
198# toke.c
199use warning 'syntax' ;
200$_ = "ab" ;
201s/(ab)/\1/e;
202EXPECT
203Can't use \1 to mean $1 in expression at - line 4.
204########
205# toke.c
206use warning 'reserved' ;
207$a = abc;
208EXPECT
209Unquoted string "abc" may clash with future reserved word at - line 3.
210########
211# toke.c
212use warning 'octal' ;
213chmod 3;
214EXPECT
215chmod: mode argument is missing initial 0 at - line 3, at end of line
216########
217# toke.c
218use warning 'syntax' ;
219@a = qw(a, b, c) ;
220EXPECT
221Possible attempt to separate words with commas at - line 3.
222########
223# toke.c
224use warning 'syntax' ;
225@a = qw(a b #) ;
226EXPECT
227Possible attempt to put comments in qw() list at - line 3.
228########
229# toke.c
230use warning 'octal' ;
231umask 3;
232EXPECT
233umask: argument is missing initial 0 at - line 3, at end of line
234########
235# toke.c
236use warning 'syntax' ;
237print ("")
238EXPECT
239print (...) interpreted as function at - line 3.
240########
241# toke.c
242use warning 'syntax' ;
243printf ("")
244EXPECT
245printf (...) interpreted as function at - line 3.
246########
247# toke.c
248use warning 'syntax' ;
249sort ("")
250EXPECT
251sort (...) interpreted as function at - line 3.
252########
253# toke.c
254use warning 'ambiguous' ;
255$a = ${time[2]};
256EXPECT
257Ambiguous use of ${time[...]} resolved to $time[...] at - line 3.
258########
259# toke.c
260use warning 'ambiguous' ;
261$a = ${time{2}};
262EXPECT
263Ambiguous use of ${time{...}} resolved to $time{...} at - line 3.
264########
265# toke.c
266use warning 'ambiguous' ;
267$a = ${time} ;
268EXPECT
269Ambiguous use of ${time} resolved to $time at - line 3.
270########
271# toke.c
272use warning 'ambiguous' ;
273sub fred {}
274$a = ${fred} ;
275EXPECT
276Ambiguous use of ${fred} resolved to $fred at - line 4.
277########
278# toke.c
279use warning 'syntax' ;
280$a = 1_2;
281$a = 1_2345_6;
282EXPECT
283Misplaced _ in number at - line 3.
284Misplaced _ in number at - line 4.
285Misplaced _ in number at - line 4.
286########
287# toke.c
288use warning 'unsafe' ;
289$a = FRED:: ;
290EXPECT
291Bareword "FRED::" refers to nonexistent package at - line 3.
292########
293# toke.c
294use warning 'ambiguous' ;
295sub time {}
296my $a = time()
297EXPECT
298Ambiguous call resolved as CORE::time(), qualify as such or use & at - line 4.
299########
300# toke.c
301use warning 'utf8' ;
302$_ = " \x{123} " ;
303EXPECT
304Use of \x{} without utf8 declaration at - line 3.
305########
306# toke.c
307use warning 'utf8' ;
308use utf8 ;
309$_ = " \xffe " ;
310EXPECT
311\xff will produce malformed UTF-8 character; use \x{ff} for that at - line 4.