Re: [PATCH] length of undefined $(digit) should warn
[p5sagit/p5-mst-13.2.git] / t / lib / warnings / regcomp
CommitLineData
599cee73 1 regcomp.c AOK
2
f9373011 3 Quantifier unexpected on zero-length expression [S_study_chunk]
4
5 (?p{}) is deprecated - use (??{}) [S_reg]
6 $a =~ /(?p{'x'})/ ;
7
8
9 Useless (%s%c) - %suse /%c modifier [S_reg]
10 Useless (%sc) - %suse /gc modifier [S_reg]
11
12
13
767a6a26 14 Strange *+?{} on zero-length expression [S_study_chunk]
15 /(?=a)?/
599cee73 16
767a6a26 17 %.*s matches null string many times [S_regpiece]
599cee73 18 $a = "ABC123" ; $a =~ /(?=a)*/'
19
ac561586 20 /%.127s/: Unrecognized escape \\%c passed through [S_regatom]
e476b1b5 21 $x = '\m' ; /$x/
599cee73 22
f9373011 23 POSIX syntax [%c %c] is reserved for future extensions [S_checkposixcc]
24
25
ac561586 26 Character class [:%.*s:] unknown [S_regpposixcc]
27
767a6a26 28 Character class syntax [%c %c] belongs inside character classes [S_checkposixcc]
29
73b437c8 30 /%.127s/: false [] range \"%*.*s\" in regexp [S_regclass]
599cee73 31
73b437c8 32 /%.127s/: false [] range \"%*.*s\" in regexp [S_regclassutf8]
599cee73 33
1028017a 34 /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclass]
35
36 /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclassutf8]
37
f9373011 38 False [] range \"%*.*s\" [S_regclass]
39
599cee73 40__END__
767a6a26 41# regcomp.c [S_regpiece]
e476b1b5 42use warnings 'regexp' ;
599cee73 43my $a = "ABC123" ;
44$a =~ /(?=a)*/ ;
e476b1b5 45no warnings 'regexp' ;
0453d815 46$a =~ /(?=a)*/ ;
599cee73 47EXPECT
7253e4e3 48(?=a)* matches null string many times in regex; marked by <-- HERE in m/(?=a)* <-- HERE / at - line 4.
599cee73 49########
767a6a26 50# regcomp.c [S_regatom]
e476b1b5 51$x = '\m' ;
52use warnings 'regexp' ;
53$a =~ /a$x/ ;
54no warnings 'regexp' ;
55$a =~ /a$x/ ;
767a6a26 56EXPECT
7253e4e3 57Unrecognized escape \m passed through in regex; marked by <-- HERE in m/a\m <-- HERE / at - line 4.
767a6a26 58########
59# regcomp.c [S_regpposixcc S_checkposixcc]
7f01dc7a 60#
e476b1b5 61use warnings 'regexp' ;
599cee73 62$_ = "" ;
e8c223df 63/[:alpha:]/;
e8c223df 64/[:zog:]/;
ac561586 65/[[:zog:]]/;
e476b1b5 66no warnings 'regexp' ;
e8c223df 67/[:alpha:]/;
ac561586 68/[:zog:]/;
3802429d 69/[[:zog:]]/;
599cee73 70EXPECT
7253e4e3 71POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:alpha:] <-- HERE / at - line 5.
72POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:zog:] <-- HERE / at - line 6.
73POSIX class [:zog:] unknown in regex; marked by <-- HERE in m/[[:zog:] <-- HERE ]/
3802429d 74########
75# regcomp.c [S_checkposixcc]
7f01dc7a 76#
3802429d 77use warnings 'regexp' ;
78$_ = "" ;
79/[.zog.]/;
80no warnings 'regexp' ;
81/[.zog.]/;
82EXPECT
7253e4e3 83POSIX syntax [. .] belongs inside character classes in regex; marked by <-- HERE in m/[.zog.] <-- HERE / at - line 5.
84POSIX syntax [. .] is reserved for future extensions in regex; marked by <-- HERE in m/[.zog.] <-- HERE /
3802429d 85########
86# regcomp.c [S_checkposixcc]
7f01dc7a 87#
3802429d 88use warnings 'regexp' ;
89$_ = "" ;
90/[[.zog.]]/;
91no warnings 'regexp' ;
92/[[.zog.]]/;
93EXPECT
7253e4e3 94POSIX syntax [. .] is reserved for future extensions in regex; marked by <-- HERE in m/[[.zog.] <-- HERE ]/
73b437c8 95########
96# regcomp.c [S_regclass]
97$_ = "";
e476b1b5 98use warnings 'regexp' ;
73b437c8 99/[a-b]/;
100/[a-\d]/;
101/[\d-b]/;
102/[\s-\d]/;
103/[\d-\s]/;
104/[a-[:digit:]]/;
105/[[:digit:]-b]/;
106/[[:alpha:]-[:digit:]]/;
107/[[:digit:]-[:alpha:]]/;
e476b1b5 108no warnings 'regexp' ;
73b437c8 109/[a-b]/;
110/[a-\d]/;
111/[\d-b]/;
112/[\s-\d]/;
113/[\d-\s]/;
114/[a-[:digit:]]/;
115/[[:digit:]-b]/;
116/[[:alpha:]-[:digit:]]/;
117/[[:digit:]-[:alpha:]]/;
118EXPECT
7253e4e3 119False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 5.
120False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 6.
121False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 7.
122False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 8.
123False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 9.
124False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 10.
125False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 11.
126False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 12.
73b437c8 127########
128# regcomp.c [S_regclassutf8]
59af8754 129BEGIN {
130 if (ord("\t") == 5) {
131 print "SKIPPED\n# ebcdic regular expression ranges differ.";
132 exit 0;
133 }
134}
73b437c8 135use utf8;
136$_ = "";
e476b1b5 137use warnings 'regexp' ;
73b437c8 138/[a-b]/;
139/[a-\d]/;
140/[\d-b]/;
141/[\s-\d]/;
142/[\d-\s]/;
143/[a-[:digit:]]/;
144/[[:digit:]-b]/;
145/[[:alpha:]-[:digit:]]/;
146/[[:digit:]-[:alpha:]]/;
e476b1b5 147no warnings 'regexp' ;
73b437c8 148/[a-b]/;
149/[a-\d]/;
150/[\d-b]/;
151/[\s-\d]/;
152/[\d-\s]/;
153/[a-[:digit:]]/;
154/[[:digit:]-b]/;
155/[[:alpha:]-[:digit:]]/;
156/[[:digit:]-[:alpha:]]/;
157EXPECT
7253e4e3 158False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 12.
159False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 13.
160False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 14.
161False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 15.
162False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 16.
163False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 17.
164False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 18.
165False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 19.
1028017a 166########
167# regcomp.c [S_regclass S_regclassutf8]
e476b1b5 168use warnings 'regexp' ;
1028017a 169$a =~ /[a\zb]/ ;
e476b1b5 170no warnings 'regexp' ;
1028017a 171$a =~ /[a\zb]/ ;
172EXPECT
7253e4e3 173Unrecognized escape \z in character class passed through in regex; marked by <-- HERE in m/[a\z <-- HERE b]/ at - line 3.
b45f050a 174
f9373011 175########
176# regcomp.c [S_study_chunk]
177use warnings 'deprecated' ;
178$a = "xx" ;
179$a =~ /(?p{'x'})/ ;
180no warnings ;
181use warnings 'regexp' ;
182$a =~ /(?p{'x'})/ ;
183use warnings;
184no warnings 'deprecated' ;
185no warnings 'regexp' ;
186$a =~ /(?p{'x'})/ ;
187EXPECT
188(?p{}) is deprecated - use (??{}) in regex; marked by <-- HERE in m/(?p <-- HERE {'x'})/ at - line 4.
189(?p{}) is deprecated - use (??{}) in regex; marked by <-- HERE in m/(?p <-- HERE {'x'})/ at - line 7.
190########
191# regcomp.c [S_reg]
192use warnings 'regexp' ;
193$a = qr/(?c)/;
194$a = qr/(?-c)/;
195$a = qr/(?g)/;
196$a = qr/(?-g)/;
197$a = qr/(?o)/;
198$a = qr/(?-o)/;
199$a = qr/(?g-o)/;
200$a = qr/(?g-c)/;
201$a = qr/(?o-cg)/; # (?c) means (?g) error won't be thrown
202$a = qr/(?ogc)/;
203no warnings 'regexp' ;
204$a = qr/(?c)/;
205$a = qr/(?-c)/;
206$a = qr/(?g)/;
207$a = qr/(?-g)/;
208$a = qr/(?o)/;
209$a = qr/(?-o)/;
210$a = qr/(?g-o)/;
211$a = qr/(?g-c)/;
212$a = qr/(?o-cg)/; # (?c) means (?g) error won't be thrown
213$a = qr/(?ogc)/;
214#EXPECT
215EXPECT
216Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?c <-- HERE )/ at - line 3.
217Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?-c <-- HERE )/ at - line 4.
218Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE )/ at - line 5.
219Useless (?-g) - don't use /g modifier in regex; marked by <-- HERE in m/(?-g <-- HERE )/ at - line 6.
220Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE )/ at - line 7.
221Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?-o <-- HERE )/ at - line 8.
222Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -o)/ at - line 9.
223Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?g-o <-- HERE )/ at - line 9.
224Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -c)/ at - line 10.
225Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?g-c <-- HERE )/ at - line 10.
226Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE -cg)/ at - line 11.
227Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?o-c <-- HERE g)/ at - line 11.
228Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE gc)/ at - line 12.
229Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?og <-- HERE c)/ at - line 12.
230Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?ogc <-- HERE )/ at - line 12.