This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlapi: Fix grammar
[perl5.git] / t / lib / warnings / regexec
CommitLineData
599cee73
PM
1 regexec.c
2
0f4592ef
GS
3 This test generates "bad free" warnings when run under
4 PERL_DESTRUCT_LEVEL. This file merely serves as a placeholder
5 for investigation.
6
90ba36ed 7 Complex regular subexpression recursion limit (%d) exceeded
599cee73
PM
8
9 $_ = 'a' x (2**15+1); /^()(a\1)*$/ ;
90ba36ed 10 Complex regular subexpression recursion limit (%d) exceeded
599cee73
PM
11
12 $_ = 'a' x (2**15+1); /^()(a\1)*?$/ ;
13
90ba36ed
DD
14 (The actual value substituted for %d is masked in the tests so that
15 REG_INFTY configuration variable value does not affect outcome.)
599cee73
PM
16__END__
17# regexec.c
0f4592ef 18print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
e476b1b5 19use warnings 'regexp' ;
90ba36ed
DD
20$SIG{__WARN__} = sub{local ($m) = shift;
21 $m =~ s/\(\d+\)/(*MASKED*)/;
22 print STDERR $m};
599cee73
PM
23$_ = 'a' x (2**15+1);
24/^()(a\1)*$/ ;
d008e5eb
GS
25#
26# If this test fails with a segmentation violation or similar,
27# you may have to increase the default stacksize limit in your
28# shell. You may need superuser privileges.
29#
30# Under the sh, ksh, zsh:
31# $ ulimit -s
32# 8192
33# $ ulimit -s 16000
34#
35# Under the csh:
36# % limit stacksize
37# stacksize 8192 kbytes
38# % limit stacksize 16000
39#
599cee73 40EXPECT
90ba36ed 41Complex regular subexpression recursion limit (*MASKED*) exceeded at - line 9.
599cee73
PM
42########
43# regexec.c
0f4592ef 44print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
e476b1b5 45no warnings 'regexp' ;
0453d815
PM
46$SIG{__WARN__} = sub{local ($m) = shift;
47 $m =~ s/\(\d+\)/(*MASKED*)/;
48 print STDERR $m};
49$_ = 'a' x (2**15+1);
50/^()(a\1)*$/ ;
51#
52# If this test fails with a segmentation violation or similar,
53# you may have to increase the default stacksize limit in your
54# shell. You may need superuser privileges.
55#
56# Under the sh, ksh, zsh:
57# $ ulimit -s
58# 8192
59# $ ulimit -s 16000
60#
61# Under the csh:
62# % limit stacksize
63# stacksize 8192 kbytes
64# % limit stacksize 16000
65#
66EXPECT
67
68########
69# regexec.c
70print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
e476b1b5 71use warnings 'regexp' ;
90ba36ed
DD
72$SIG{__WARN__} = sub{local ($m) = shift;
73 $m =~ s/\(\d+\)/(*MASKED*)/;
74 print STDERR $m};
599cee73
PM
75$_ = 'a' x (2**15+1);
76/^()(a\1)*?$/ ;
d008e5eb
GS
77#
78# If this test fails with a segmentation violation or similar,
79# you may have to increase the default stacksize limit in your
80# shell. You may need superuser privileges.
81#
82# Under the sh, ksh, zsh:
83# $ ulimit -s
84# 8192
85# $ ulimit -s 16000
86#
87# Under the csh:
88# % limit stacksize
89# stacksize 8192 kbytes
90# % limit stacksize 16000
91#
599cee73 92EXPECT
90ba36ed 93Complex regular subexpression recursion limit (*MASKED*) exceeded at - line 9.
0453d815
PM
94########
95# regexec.c
96print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
e476b1b5 97no warnings 'regexp' ;
0453d815
PM
98$SIG{__WARN__} = sub{local ($m) = shift;
99 $m =~ s/\(\d+\)/(*MASKED*)/;
100 print STDERR $m};
101$_ = 'a' x (2**15+1);
102/^()(a\1)*?$/ ;
103#
104# If this test fails with a segmentation violation or similar,
105# you may have to increase the default stacksize limit in your
106# shell. You may need superuser privileges.
107#
108# Under the sh, ksh, zsh:
109# $ ulimit -s
110# 8192
111# $ ulimit -s 16000
112#
113# Under the csh:
114# % limit stacksize
115# stacksize 8192 kbytes
116# % limit stacksize 16000
117#
118EXPECT
119
613abc6d
KW
120########
121# NAME Wide character in non-UTF-8 locale
ef9d5242
KW
122require '../loc_tools.pl';
123unless (locales_enabled()) {
124 print("SKIPPED\n# locales not available\n"),exit;
125}
613abc6d
KW
126eval { require POSIX; POSIX->import("locale_h") };
127if ($@) {
128 print("SKIPPED\n# no POSIX\n"),exit;
129}
130use warnings 'locale';
131use locale;
132setlocale(&POSIX::LC_CTYPE, "C");
133"\x{100}" =~ /\x{100}|\x{101}/il;
134"\x{100}" =~ /\x{100}|\x{101}/l;
135"\x{100}" =~ /\w/l;
136"\x{100}" =~ /\x{100}+/l;
137"\x{100}" =~ /[\x{100}\x{102}]/l;
138no warnings 'locale';
139EXPECT
613abc6d
KW
140Wide character (U+100) in pattern match (m//) at - line 12.
141Wide character (U+100) in pattern match (m//) at - line 12.
ef9d5242
KW
142Wide character (U+100) in pattern match (m//) at - line 13.
143Wide character (U+100) in pattern match (m//) at - line 13.
144Wide character (U+100) in pattern match (m//) at - line 13.
145Wide character (U+100) in pattern match (m//) at - line 14.
146Wide character (U+100) in pattern match (m//) at - line 14.
147Wide character (U+100) in pattern match (m//) at - line 15.
148Wide character (U+100) in pattern match (m//) at - line 16.
149Wide character (U+100) in pattern match (m//) at - line 16.
64935bc6 150########
008e8e82
KW
151# NAME Wide character in UTF-8 locale
152require '../loc_tools.pl';
153unless (locales_enabled()) {
154 print("SKIPPED\n# locales not available\n"),exit;
155}
156eval { require POSIX; POSIX->import("locale_h") };
157if ($@) {
158 print("SKIPPED\n# no POSIX\n"),exit;
159}
160my @utf8_locales = find_utf8_ctype_locale();
161unless (@utf8_locales) {
162 print("SKIPPED\n# no UTF-8 locales\n"),exit;
163}
164use warnings 'locale';
165use locale;
166setlocale(&POSIX::LC_CTYPE, $utf8_locales[0]);
167"\x{100}" =~ /\x{100}|\x{101}/il;
168"\x{100}" =~ /\x{100}|\x{101}/l;
169"\x{100}" =~ /\w/l;
170"\x{100}" =~ /\x{100}+/l;
171"\x{100}" =~ /[\x{100}\x{102}]/l;
172EXPECT
173########
64935bc6
KW
174# NAME \b{} in non-UTF-8 locale
175eval { require POSIX; POSIX->import("locale_h") };
176if ($@) {
177 print("SKIPPED\n# no POSIX\n"),exit;
178}
179use warnings 'locale';
180use locale;
181setlocale(&POSIX::LC_CTYPE, "C");
182"a" =~ /\b{gcb}/l;
183no warnings 'locale';
184"a" =~ /\b{gcb}/l;
185EXPECT
89ad707a
KW
186Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 8.
187Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 8.
188########
189# NAME \b{} in UTF-8 locale
190require '../loc_tools.pl';
191unless (locales_enabled()) {
192 print("SKIPPED\n# locales not available\n"),exit;
193}
194eval { require POSIX; POSIX->import("locale_h") };
195if ($@) {
196 print("SKIPPED\n# no POSIX\n"),exit;
197}
198my $utf8_locale = find_utf8_ctype_locale();
199unless ($utf8_locale) {
200 print("SKIPPED\n# No UTF-8 locale available\n"),exit;
201}
202use warnings 'locale';
203use locale;
204setlocale(&POSIX::LC_CTYPE, "C");
205 "abc def" =~ /\b{wb}.*?/;
206 "abc def" =~ /\B{wb}.*?/;
207setlocale(&POSIX::LC_CTYPE, $utf8_locale);
208 "abc def" =~ /\b{wb}.*?/;
209 "abc def" =~ /\B{wb}.*?/;
210EXPECT
211Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 16.
212Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 16.
213Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 17.
214Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 17.
67481c39 215Use of \b{} or \B{} for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 17.
a0bd1a30
KW
216########
217# NAME (?[ ]) in non-UTF-8 locale
218eval { require POSIX; POSIX->import("locale_h") };
219if ($@) {
220 print("SKIPPED\n# no POSIX\n"),exit;
221}
222no warnings 'experimental::regex_sets';
223use warnings 'locale';
224use locale;
225setlocale(&POSIX::LC_CTYPE, "C");
226"\N{KELVIN SIGN}" =~ /(?[ \N{KELVIN SIGN} ])/i;
227"K" =~ /(?[ \N{KELVIN SIGN} ])/i;
228"k" =~ /(?[ \N{KELVIN SIGN} ])/i;
229":" =~ /(?[ \: ])/;
230no warnings 'locale';
231EXPECT
232Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 9.
233Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 9.
234Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 10.
235Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 10.
236Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 11.
237Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 11.
238Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 12.
239Use of (?[ ]) for non-UTF-8 locale is wrong. Assuming a UTF-8 locale at - line 12.
240########
241# NAME (?[ ]) in UTF-8 locale
242require '../loc_tools.pl';
243unless (locales_enabled()) {
244 print("SKIPPED\n# locales not available\n"),exit;
245}
246eval { require POSIX; POSIX->import("locale_h") };
247if ($@) {
248 print("SKIPPED\n# no POSIX\n"),exit;
249}
250my $utf8_locale = find_utf8_ctype_locale();
251unless ($utf8_locale) {
252 print("SKIPPED\n# No UTF-8 locale available\n"),exit;
253}
254no warnings 'experimental::regex_sets';
255use warnings 'locale';
256use locale;
257setlocale(&POSIX::LC_CTYPE, $utf8_locale);
258"\N{KELVIN SIGN}" =~ /(?[ \N{KELVIN SIGN} ])/i;
259"K" =~ /(?[ \N{KELVIN SIGN} ])/i;
260"k" =~ /(?[ \N{KELVIN SIGN} ])/i;
261":" =~ /(?[ \: ])/;
262EXPECT