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