Actually submit previous change.
[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
cd84f5b2 23 POSIX syntax [%c %c] belongs inside character classes [S_checkposixcc]
f9373011 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########
cc74c5bd 59# regcomp.c [S_regatom]
60# The \q should warn, the \_ should NOT warn.
61use warnings 'regexp';
62"foo" =~ /\q/;
63"bar" =~ /\_/;
64no warnings 'regexp';
65"foo" =~ /\q/;
66"bar" =~ /\_/;
67EXPECT
68Unrecognized escape \q passed through in regex; marked by <-- HERE in m/\q <-- HERE / at - line 4.
69########
767a6a26 70# regcomp.c [S_regpposixcc S_checkposixcc]
7f01dc7a 71#
e476b1b5 72use warnings 'regexp' ;
599cee73 73$_ = "" ;
e8c223df 74/[:alpha:]/;
e8c223df 75/[:zog:]/;
e476b1b5 76no warnings 'regexp' ;
e8c223df 77/[:alpha:]/;
ac561586 78/[:zog:]/;
599cee73 79EXPECT
7253e4e3 80POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:alpha:] <-- HERE / at - line 5.
81POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:zog:] <-- HERE / at - line 6.
3802429d 82########
83# regcomp.c [S_checkposixcc]
7f01dc7a 84#
3802429d 85use warnings 'regexp' ;
86$_ = "" ;
87/[.zog.]/;
88no warnings 'regexp' ;
89/[.zog.]/;
90EXPECT
7253e4e3 91POSIX syntax [. .] belongs inside character classes in regex; marked by <-- HERE in m/[.zog.] <-- HERE / at - line 5.
d0808320 92POSIX syntax [. .] is reserved for future extensions in regex; marked by <-- HERE in m/[.zog.] <-- HERE / at - line 5.
3802429d 93########
73b437c8 94# regcomp.c [S_regclass]
95$_ = "";
e476b1b5 96use warnings 'regexp' ;
73b437c8 97/[a-b]/;
98/[a-\d]/;
99/[\d-b]/;
100/[\s-\d]/;
101/[\d-\s]/;
102/[a-[:digit:]]/;
103/[[:digit:]-b]/;
104/[[:alpha:]-[:digit:]]/;
105/[[:digit:]-[:alpha:]]/;
e476b1b5 106no warnings 'regexp' ;
73b437c8 107/[a-b]/;
108/[a-\d]/;
109/[\d-b]/;
110/[\s-\d]/;
111/[\d-\s]/;
112/[a-[:digit:]]/;
113/[[:digit:]-b]/;
114/[[:alpha:]-[:digit:]]/;
115/[[:digit:]-[:alpha:]]/;
116EXPECT
7253e4e3 117False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 5.
118False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 6.
119False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 7.
120False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 8.
121False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 9.
122False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 10.
123False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 11.
124False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 12.
73b437c8 125########
126# regcomp.c [S_regclassutf8]
59af8754 127BEGIN {
128 if (ord("\t") == 5) {
129 print "SKIPPED\n# ebcdic regular expression ranges differ.";
130 exit 0;
131 }
132}
73b437c8 133use utf8;
134$_ = "";
e476b1b5 135use warnings 'regexp' ;
73b437c8 136/[a-b]/;
137/[a-\d]/;
138/[\d-b]/;
139/[\s-\d]/;
140/[\d-\s]/;
141/[a-[:digit:]]/;
142/[[:digit:]-b]/;
143/[[:alpha:]-[:digit:]]/;
144/[[:digit:]-[:alpha:]]/;
e476b1b5 145no warnings 'regexp' ;
73b437c8 146/[a-b]/;
147/[a-\d]/;
148/[\d-b]/;
149/[\s-\d]/;
150/[\d-\s]/;
151/[a-[:digit:]]/;
152/[[:digit:]-b]/;
153/[[:alpha:]-[:digit:]]/;
154/[[:digit:]-[:alpha:]]/;
155EXPECT
7253e4e3 156False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 12.
157False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 13.
158False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 14.
159False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 15.
160False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 16.
161False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 17.
162False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 18.
163False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 19.
1028017a 164########
165# regcomp.c [S_regclass S_regclassutf8]
e476b1b5 166use warnings 'regexp' ;
1028017a 167$a =~ /[a\zb]/ ;
e476b1b5 168no warnings 'regexp' ;
1028017a 169$a =~ /[a\zb]/ ;
170EXPECT
7253e4e3 171Unrecognized escape \z in character class passed through in regex; marked by <-- HERE in m/[a\z <-- HERE b]/ at - line 3.
b45f050a 172
f9373011 173########
174# regcomp.c [S_study_chunk]
175use warnings 'deprecated' ;
176$a = "xx" ;
177$a =~ /(?p{'x'})/ ;
178no warnings ;
179use warnings 'regexp' ;
180$a =~ /(?p{'x'})/ ;
181use warnings;
182no warnings 'deprecated' ;
183no warnings 'regexp' ;
12bcd1a6 184no warnings 'syntax' ;
f9373011 185$a =~ /(?p{'x'})/ ;
186EXPECT
187(?p{}) is deprecated - use (??{}) in regex; marked by <-- HERE in m/(?p <-- HERE {'x'})/ at - line 4.
188(?p{}) is deprecated - use (??{}) in regex; marked by <-- HERE in m/(?p <-- HERE {'x'})/ at - line 7.
189########
190# regcomp.c [S_reg]
191use warnings 'regexp' ;
192$a = qr/(?c)/;
193$a = qr/(?-c)/;
194$a = qr/(?g)/;
195$a = qr/(?-g)/;
196$a = qr/(?o)/;
197$a = qr/(?-o)/;
198$a = qr/(?g-o)/;
199$a = qr/(?g-c)/;
200$a = qr/(?o-cg)/; # (?c) means (?g) error won't be thrown
201$a = qr/(?ogc)/;
202no warnings 'regexp' ;
203$a = qr/(?c)/;
204$a = qr/(?-c)/;
205$a = qr/(?g)/;
206$a = qr/(?-g)/;
207$a = qr/(?o)/;
208$a = qr/(?-o)/;
209$a = qr/(?g-o)/;
210$a = qr/(?g-c)/;
211$a = qr/(?o-cg)/; # (?c) means (?g) error won't be thrown
212$a = qr/(?ogc)/;
213#EXPECT
214EXPECT
215Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?c <-- HERE )/ at - line 3.
216Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?-c <-- HERE )/ at - line 4.
217Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE )/ at - line 5.
218Useless (?-g) - don't use /g modifier in regex; marked by <-- HERE in m/(?-g <-- HERE )/ at - line 6.
219Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE )/ at - line 7.
220Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?-o <-- HERE )/ at - line 8.
221Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -o)/ at - line 9.
222Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?g-o <-- HERE )/ at - line 9.
223Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -c)/ at - line 10.
224Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?g-c <-- HERE )/ at - line 10.
225Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE -cg)/ at - line 11.
226Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?o-c <-- HERE g)/ at - line 11.
227Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE gc)/ at - line 12.
228Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?og <-- HERE c)/ at - line 12.
229Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?ogc <-- HERE )/ at - line 12.