Warn about false ranges like \d-\w (see the change #4355).
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / regcomp
CommitLineData
599cee73 1 regcomp.c AOK
2
767a6a26 3 Strange *+?{} on zero-length expression [S_study_chunk]
4 /(?=a)?/
599cee73 5
767a6a26 6 %.*s matches null string many times [S_regpiece]
599cee73 7 $a = "ABC123" ; $a =~ /(?=a)*/'
8
767a6a26 9 /%.127s/: Unrecognized escape \\%c passed through" [S_regatom]
10 /\m/
599cee73 11
767a6a26 12 Character class syntax [. .] is reserved for future extensions [S_regpposixcc]
13
14 Character class syntax [= =] is reserved for future extensions [S_checkposixcc]
15
16 Character class syntax [%c %c] belongs inside character classes [S_checkposixcc]
17
73b437c8 18 /%.127s/: false [] range \"%*.*s\" in regexp [S_regclass]
599cee73 19
73b437c8 20 /%.127s/: false [] range \"%*.*s\" in regexp [S_regclassutf8]
599cee73 21
22__END__
767a6a26 23# regcomp.c [S_regpiece]
4438c4b7 24use warnings 'unsafe' ;
599cee73 25my $a = "ABC123" ;
26$a =~ /(?=a)*/ ;
4438c4b7 27no warnings 'unsafe' ;
0453d815 28$a =~ /(?=a)*/ ;
599cee73 29EXPECT
30(?=a)* matches null string many times at - line 4.
31########
767a6a26 32# regcomp.c [S_study_chunk]
4438c4b7 33use warnings 'unsafe' ;
599cee73 34$_ = "" ;
35/(?=a)?/;
4438c4b7 36no warnings 'unsafe' ;
0453d815 37/(?=a)?/;
599cee73 38EXPECT
39Strange *+?{} on zero-length expression at - line 4.
40########
767a6a26 41# regcomp.c [S_regatom]
42use warnings 'unsafe' ;
43$a =~ /\m/ ;
44no warnings 'unsafe' ;
45EXPECT
46Unrecognized escape \m passed through at - line 3.
47########
48# regcomp.c [S_regpposixcc S_checkposixcc]
4438c4b7 49use warnings 'unsafe' ;
599cee73 50$_ = "" ;
e8c223df 51/[:alpha:]/;
b8c5462f 52/[.bar.]/;
53/[=zog=]/;
e8c223df 54/[[:alpha:]]/;
55/[[.foo.]]/;
56/[[=bar=]]/;
57/[:zog:]/;
4438c4b7 58no warnings 'unsafe' ;
e8c223df 59/[:alpha:]/;
60/[.foo.]/;
61/[=bar=]/;
62/[[:alpha:]]/;
63/[[.foo.]]/;
64/[[=bar=]]/;
65/[:zog:]/;
66/[[:zog:]]/;
599cee73 67EXPECT
b8c5462f 68Character class syntax [: :] belongs inside character classes at - line 4.
69Character class syntax [. .] belongs inside character classes at - line 5.
70Character class syntax [. .] is reserved for future extensions at - line 5.
71Character class syntax [= =] belongs inside character classes at - line 6.
72Character class syntax [= =] is reserved for future extensions at - line 6.
e8c223df 73Character class syntax [. .] is reserved for future extensions at - line 8.
74Character class syntax [= =] is reserved for future extensions at - line 9.
75Character class syntax [: :] belongs inside character classes at - line 10.
76Character class [:zog:] unknown at - line 19.
73b437c8 77########
78# regcomp.c [S_regclass]
79$_ = "";
80use warnings 'unsafe' ;
81/[a-b]/;
82/[a-\d]/;
83/[\d-b]/;
84/[\s-\d]/;
85/[\d-\s]/;
86/[a-[:digit:]]/;
87/[[:digit:]-b]/;
88/[[:alpha:]-[:digit:]]/;
89/[[:digit:]-[:alpha:]]/;
90no warnings 'unsafe' ;
91/[a-b]/;
92/[a-\d]/;
93/[\d-b]/;
94/[\s-\d]/;
95/[\d-\s]/;
96/[a-[:digit:]]/;
97/[[:digit:]-b]/;
98/[[:alpha:]-[:digit:]]/;
99/[[:digit:]-[:alpha:]]/;
100EXPECT
101/[a-\d]/: false [] range "a-\d" in regexp at - line 5.
102/[\d-b]/: false [] range "\d-" in regexp at - line 6.
103/[\s-\d]/: false [] range "\s-" in regexp at - line 7.
104/[\d-\s]/: false [] range "\d-" in regexp at - line 8.
105/[a-[:digit:]]/: false [] range "a-[:digit:]" in regexp at - line 9.
106/[[:digit:]-b]/: false [] range "[:digit:]-" in regexp at - line 10.
107/[[:alpha:]-[:digit:]]/: false [] range "[:alpha:]-" in regexp at - line 11.
108/[[:digit:]-[:alpha:]]/: false [] range "[:digit:]-" in regexp at - line 12.
109########
110# regcomp.c [S_regclassutf8]
111use utf8;
112$_ = "";
113use warnings 'unsafe' ;
114/[a-b]/;
115/[a-\d]/;
116/[\d-b]/;
117/[\s-\d]/;
118/[\d-\s]/;
119/[a-[:digit:]]/;
120/[[:digit:]-b]/;
121/[[:alpha:]-[:digit:]]/;
122/[[:digit:]-[:alpha:]]/;
123no warnings 'unsafe' ;
124/[a-b]/;
125/[a-\d]/;
126/[\d-b]/;
127/[\s-\d]/;
128/[\d-\s]/;
129/[a-[:digit:]]/;
130/[[:digit:]-b]/;
131/[[:alpha:]-[:digit:]]/;
132/[[:digit:]-[:alpha:]]/;
133EXPECT
134/[a-\d]/: false [] range "a-\d" in regexp at - line 6.
135/[\d-b]/: false [] range "\d-" in regexp at - line 7.
136/[\s-\d]/: false [] range "\s-" in regexp at - line 8.
137/[\d-\s]/: false [] range "\d-" in regexp at - line 9.
138/[a-[:digit:]]/: false [] range "a-[:digit:]" in regexp at - line 10.
139/[[:digit:]-b]/: false [] range "[:digit:]-" in regexp at - line 11.
140/[[:alpha:]-[:digit:]]/: false [] range "[:alpha:]-" in regexp at - line 12.
141/[[:digit:]-[:alpha:]]/: false [] range "[:digit:]-" in regexp at - line 13.