warn about CHECK and INIT blocks encountered at run time
[p5sagit/p5-mst-13.2.git] / t / pragma / warn / regcomp
1   regcomp.c     AOK
2
3   Strange *+?{} on zero-length expression       [S_study_chunk]
4         /(?=a)?/
5
6   %.*s matches null string many times           [S_regpiece]
7         $a = "ABC123" ; $a =~ /(?=a)*/'
8
9   /%.127s/: Unrecognized escape \\%c passed through     [S_regatom] 
10         $x = '\m' ; /$x/
11
12   Character class [:%.*s:] unknown      [S_regpposixcc]
13
14   Character class syntax [. .] is reserved for future extensions [S_regpposixcc]
15
16   Character class syntax [= =] is reserved for future extensions [S_checkposixcc]
17
18   Character class syntax [%c %c] belongs inside character classes [S_checkposixcc] 
19   
20   /%.127s/: false [] range \"%*.*s\" in regexp [S_regclass]
21
22   /%.127s/: false [] range \"%*.*s\" in regexp [S_regclassutf8]
23
24   /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclass] 
25
26   /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclassutf8] 
27
28 __END__
29 # regcomp.c [S_regpiece]
30 use warnings 'regexp' ;
31 my $a = "ABC123" ; 
32 $a =~ /(?=a)*/ ;
33 no warnings 'regexp' ;
34 $a =~ /(?=a)*/ ;
35 EXPECT
36 (?=a)* matches null string many times at - line 4.
37 ########
38 # regcomp.c [S_study_chunk]
39 use warnings 'regexp' ;
40 $_ = "" ;
41 /(?=a)?/;
42 no warnings 'regexp' ;
43 /(?=a)?/;
44 EXPECT
45 Strange *+?{} on zero-length expression at - line 4.
46 ########
47 # regcomp.c [S_regatom]
48 $x = '\m' ;
49 use warnings 'regexp' ;
50 $a =~ /a$x/ ;
51 no warnings 'regexp' ;
52 $a =~ /a$x/ ;
53 EXPECT
54 /a\m/: Unrecognized escape \m passed through at - line 4.
55 ########
56 # regcomp.c [S_regpposixcc S_checkposixcc]
57 BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 }
58 use warnings 'regexp' ;
59 $_ = "" ;
60 /[:alpha:]/;
61 /[.bar.]/;
62 /[=zog=]/;
63 /[[:alpha:]]/;
64 /[[.foo.]]/;
65 /[[=bar=]]/;
66 /[:zog:]/;
67 /[[:zog:]]/;
68 no warnings 'regexp' ;
69 /[:alpha:]/;
70 /[.foo.]/;
71 /[=bar=]/;
72 /[[:alpha:]]/;
73 /[[.foo.]]/;
74 /[[=bar=]]/;
75 /[[:zog:]]/;
76 /[:zog:]/;
77 EXPECT
78 Character class syntax [: :] belongs inside character classes at - line 5.
79 Character class syntax [. .] belongs inside character classes at - line 6.
80 Character class syntax [. .] is reserved for future extensions at - line 6.
81 Character class syntax [= =] belongs inside character classes at - line 7.
82 Character class syntax [= =] is reserved for future extensions at - line 7.
83 Character class syntax [. .] is reserved for future extensions at - line 9.
84 Character class syntax [= =] is reserved for future extensions at - line 10.
85 Character class syntax [: :] belongs inside character classes at - line 11.
86 Character class [:zog:] unknown at - line 12.
87 ########
88 # regcomp.c [S_regclass]
89 $_ = "";
90 use warnings 'regexp' ;
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:]]/;
100 no warnings 'regexp' ;
101 /[a-b]/;
102 /[a-\d]/;
103 /[\d-b]/;
104 /[\s-\d]/;
105 /[\d-\s]/;
106 /[a-[:digit:]]/;
107 /[[:digit:]-b]/;
108 /[[:alpha:]-[:digit:]]/;
109 /[[:digit:]-[:alpha:]]/;
110 EXPECT
111 /[a-\d]/: false [] range "a-\d" in regexp at - line 5.
112 /[\d-b]/: false [] range "\d-" in regexp at - line 6.
113 /[\s-\d]/: false [] range "\s-" in regexp at - line 7.
114 /[\d-\s]/: false [] range "\d-" in regexp at - line 8.
115 /[a-[:digit:]]/: false [] range "a-[:digit:]" in regexp at - line 9.
116 /[[:digit:]-b]/: false [] range "[:digit:]-" in regexp at - line 10.
117 /[[:alpha:]-[:digit:]]/: false [] range "[:alpha:]-" in regexp at - line 11.
118 /[[:digit:]-[:alpha:]]/: false [] range "[:digit:]-" in regexp at - line 12.
119 ########
120 # regcomp.c [S_regclassutf8]
121 BEGIN {
122     if (ord("\t") == 5) {
123         print "SKIPPED\n# ebcdic regular expression ranges differ.";
124         exit 0;
125     }
126 }
127 use utf8;
128 $_ = "";
129 use warnings 'regexp' ;
130 /[a-b]/;
131 /[a-\d]/;
132 /[\d-b]/;
133 /[\s-\d]/;
134 /[\d-\s]/;
135 /[a-[:digit:]]/;
136 /[[:digit:]-b]/;
137 /[[:alpha:]-[:digit:]]/;
138 /[[:digit:]-[:alpha:]]/;
139 no warnings 'regexp' ;
140 /[a-b]/;
141 /[a-\d]/;
142 /[\d-b]/;
143 /[\s-\d]/;
144 /[\d-\s]/;
145 /[a-[:digit:]]/;
146 /[[:digit:]-b]/;
147 /[[:alpha:]-[:digit:]]/;
148 /[[:digit:]-[:alpha:]]/;
149 EXPECT
150 /[a-\d]/: false [] range "a-\d" in regexp at - line 12.
151 /[\d-b]/: false [] range "\d-" in regexp at - line 13.
152 /[\s-\d]/: false [] range "\s-" in regexp at - line 14.
153 /[\d-\s]/: false [] range "\d-" in regexp at - line 15.
154 /[a-[:digit:]]/: false [] range "a-[:digit:]" in regexp at - line 16.
155 /[[:digit:]-b]/: false [] range "[:digit:]-" in regexp at - line 17.
156 /[[:alpha:]-[:digit:]]/: false [] range "[:alpha:]-" in regexp at - line 18.
157 /[[:digit:]-[:alpha:]]/: false [] range "[:digit:]-" in regexp at - line 19.
158 ########
159 # regcomp.c [S_regclass S_regclassutf8]
160 use warnings 'regexp' ;
161 $a =~ /[a\zb]/ ;
162 no warnings 'regexp' ;
163 $a =~ /[a\zb]/ ;
164 EXPECT
165 /[a\zb]/: Unrecognized escape \z in character class passed through at - line 3.