Actually submit previous change.
[p5sagit/p5-mst-13.2.git] / t / lib / warnings / regcomp
1   regcomp.c     AOK
2
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
14   Strange *+?{} on zero-length expression       [S_study_chunk]
15         /(?=a)?/
16
17   %.*s matches null string many times           [S_regpiece]
18         $a = "ABC123" ; $a =~ /(?=a)*/'
19
20   /%.127s/: Unrecognized escape \\%c passed through     [S_regatom] 
21         $x = '\m' ; /$x/
22
23   POSIX syntax [%c %c] belongs inside character classes [S_checkposixcc] 
24
25
26   Character class [:%.*s:] unknown      [S_regpposixcc]
27
28   Character class syntax [%c %c] belongs inside character classes [S_checkposixcc] 
29   
30   /%.127s/: false [] range \"%*.*s\" in regexp [S_regclass]
31
32   /%.127s/: false [] range \"%*.*s\" in regexp [S_regclassutf8]
33
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
38   False [] range \"%*.*s\" [S_regclass]
39
40 __END__
41 # regcomp.c [S_regpiece]
42 use warnings 'regexp' ;
43 my $a = "ABC123" ; 
44 $a =~ /(?=a)*/ ;
45 no warnings 'regexp' ;
46 $a =~ /(?=a)*/ ;
47 EXPECT
48 (?=a)* matches null string many times in regex; marked by <-- HERE in m/(?=a)* <-- HERE / at - line 4.
49 ########
50 # regcomp.c [S_regatom]
51 $x = '\m' ;
52 use warnings 'regexp' ;
53 $a =~ /a$x/ ;
54 no warnings 'regexp' ;
55 $a =~ /a$x/ ;
56 EXPECT
57 Unrecognized escape \m passed through in regex; marked by <-- HERE in m/a\m <-- HERE / at - line 4.
58 ########
59 # regcomp.c [S_regatom]
60 # The \q should warn, the \_ should NOT warn.
61 use warnings 'regexp';
62 "foo" =~ /\q/;
63 "bar" =~ /\_/;
64 no warnings 'regexp';
65 "foo" =~ /\q/;
66 "bar" =~ /\_/;
67 EXPECT
68 Unrecognized escape \q passed through in regex; marked by <-- HERE in m/\q <-- HERE / at - line 4.
69 ########
70 # regcomp.c [S_regpposixcc S_checkposixcc]
71 #
72 use warnings 'regexp' ;
73 $_ = "" ;
74 /[:alpha:]/;
75 /[:zog:]/;
76 no warnings 'regexp' ;
77 /[:alpha:]/;
78 /[:zog:]/;
79 EXPECT
80 POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:alpha:] <-- HERE / at - line 5.
81 POSIX syntax [: :] belongs inside character classes in regex; marked by <-- HERE in m/[:zog:] <-- HERE / at - line 6.
82 ########
83 # regcomp.c [S_checkposixcc]
84 #
85 use warnings 'regexp' ;
86 $_ = "" ;
87 /[.zog.]/;
88 no warnings 'regexp' ;
89 /[.zog.]/;
90 EXPECT
91 POSIX syntax [. .] belongs inside character classes in regex; marked by <-- HERE in m/[.zog.] <-- HERE / at - line 5.
92 POSIX syntax [. .] is reserved for future extensions in regex; marked by <-- HERE in m/[.zog.] <-- HERE / at - line 5.
93 ########
94 # regcomp.c [S_regclass]
95 $_ = "";
96 use warnings 'regexp' ;
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:]]/;
106 no warnings 'regexp' ;
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:]]/;
116 EXPECT
117 False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 5.
118 False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 6.
119 False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 7.
120 False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 8.
121 False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 9.
122 False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 10.
123 False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 11.
124 False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 12.
125 ########
126 # regcomp.c [S_regclassutf8]
127 BEGIN {
128     if (ord("\t") == 5) {
129         print "SKIPPED\n# ebcdic regular expression ranges differ.";
130         exit 0;
131     }
132 }
133 use utf8;
134 $_ = "";
135 use warnings 'regexp' ;
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:]]/;
145 no warnings 'regexp' ;
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:]]/;
155 EXPECT
156 False [] range "a-\d" in regex; marked by <-- HERE in m/[a-\d <-- HERE ]/ at - line 12.
157 False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE b]/ at - line 13.
158 False [] range "\s-" in regex; marked by <-- HERE in m/[\s- <-- HERE \d]/ at - line 14.
159 False [] range "\d-" in regex; marked by <-- HERE in m/[\d- <-- HERE \s]/ at - line 15.
160 False [] range "a-[:digit:]" in regex; marked by <-- HERE in m/[a-[:digit:] <-- HERE ]/ at - line 16.
161 False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE b]/ at - line 17.
162 False [] range "[:alpha:]-" in regex; marked by <-- HERE in m/[[:alpha:]- <-- HERE [:digit:]]/ at - line 18.
163 False [] range "[:digit:]-" in regex; marked by <-- HERE in m/[[:digit:]- <-- HERE [:alpha:]]/ at - line 19.
164 ########
165 # regcomp.c [S_regclass S_regclassutf8]
166 use warnings 'regexp' ;
167 $a =~ /[a\zb]/ ;
168 no warnings 'regexp' ;
169 $a =~ /[a\zb]/ ;
170 EXPECT
171 Unrecognized escape \z in character class passed through in regex; marked by <-- HERE in m/[a\z <-- HERE b]/ at - line 3.
172
173 ########
174 # regcomp.c [S_study_chunk]
175 use warnings 'deprecated' ;
176 $a = "xx" ;
177 $a =~ /(?p{'x'})/ ;
178 no warnings ;
179 use warnings 'regexp' ;
180 $a =~ /(?p{'x'})/ ;
181 use warnings;
182 no warnings 'deprecated' ;
183 no warnings 'regexp' ;
184 no warnings 'syntax' ;
185 $a =~ /(?p{'x'})/ ;
186 EXPECT
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]
191 use 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)/;
202 no 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
214 EXPECT
215 Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?c <-- HERE )/ at - line 3.
216 Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?-c <-- HERE )/ at - line 4.
217 Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE )/ at - line 5.
218 Useless (?-g) - don't use /g modifier in regex; marked by <-- HERE in m/(?-g <-- HERE )/ at - line 6.
219 Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE )/ at - line 7.
220 Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?-o <-- HERE )/ at - line 8.
221 Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -o)/ at - line 9.
222 Useless (?-o) - don't use /o modifier in regex; marked by <-- HERE in m/(?g-o <-- HERE )/ at - line 9.
223 Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?g <-- HERE -c)/ at - line 10.
224 Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?g-c <-- HERE )/ at - line 10.
225 Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE -cg)/ at - line 11.
226 Useless (?-c) - don't use /gc modifier in regex; marked by <-- HERE in m/(?o-c <-- HERE g)/ at - line 11.
227 Useless (?o) - use /o modifier in regex; marked by <-- HERE in m/(?o <-- HERE gc)/ at - line 12.
228 Useless (?g) - use /g modifier in regex; marked by <-- HERE in m/(?og <-- HERE c)/ at - line 12.
229 Useless (?c) - use /gc modifier in regex; marked by <-- HERE in m/(?ogc <-- HERE )/ at - line 12.