This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Revert "perlapi: Document sv_dup(_inc)?"
[perl5.git] / t / lib / warnings / regcomp
CommitLineData
63fbd1cb 1 regcomp.c These tests have been moved to t/re/reg_mesg.t
499333dc 2 except for those that explicitly test line numbers
d8d26cac
KW
3 and those that don't have a <-- HERE in them, and those that
4 die plus have warnings, or otherwise require special handling
f9373011 5
599cee73 6__END__
dd8ddecf
FC
7use warnings 'regexp';
8$r=qr/(??{ q"\\b+" })/;
9"a" =~ /a$r/; # warning should come from this line
10EXPECT
11\b+ matches null string many times in regex; marked by <-- HERE in m/\b+ <-- HERE / at - line 3.
499333dc
KW
12########
13# regcomp.c
14use warnings 'digit' ;
15my $a = qr/\o{1238456}\x{100}/;
16my $a = qr/[\o{6548321}]\x{100}/;
17no warnings 'digit' ;
18my $a = qr/\o{1238456}\x{100}/;
19my $a = qr/[\o{6548321}]\x{100}/;
20EXPECT
8d1e72f0
KW
21Non-octal character '8' terminates \o early. Resolved as "\o{123}" in regex; marked by <-- HERE in m/\o{1238456} <-- HERE \x{100}/ at - line 3.
22Non-octal character '8' terminates \o early. Resolved as "\o{654}" in regex; marked by <-- HERE in m/[\o{6548321} <-- HERE ]\x{100}/ at - line 4.
499333dc 23########
ecf931f7 24# regcomp.c
20062bee
KW
25BEGIN {
26 if (ord('A') == 193) {
27 print "SKIPPED\n# Different results on EBCDIC";
28 exit 0;
29 }
30}
499333dc
KW
31use warnings;
32$a = qr/\c,/;
33$a = qr/[\c,]/;
d4360efa 34no warnings 'syntax';
499333dc
KW
35$a = qr/\c,/;
36$a = qr/[\c,]/;
37EXPECT
73351a71
KW
38"\c," is more clearly written simply as "l" in regex; marked by <-- HERE in m/\c, <-- HERE / at - line 9.
39"\c," is more clearly written simply as "l" in regex; marked by <-- HERE in m/[\c, <-- HERE ]/ at - line 10.
285b5ca0
KW
40########
41# This is because currently a different error is output under
42# use re 'strict', so can't go in reg_mesg.t
43# NAME perl #126261, error message causes segfault
44# OPTION fatal
45 qr/abc[\x{df}[.00./i
46EXPECT
47Unmatched [ in regex; marked by <-- HERE in m/abc[ <-- HERE \x{df}[.00./ at - line 4.
48########
49# NAME perl #126261, with 'use utf8'
50# OPTION fatal
51use utf8;
52no warnings 'utf8';
53qr/abc[fi[.00./i;
54EXPECT
55Unmatched [ in regex; marked by <-- HERE in m/abc[ <-- HERE fi[.00./ at - line 4.
46d34d0e
KW
56########
57# NAME perl qr/(?[[[:word]]])/ XXX Why is 'syntax' lc?
58# OPTION fatal
60ee17b9 59use warnings;
46d34d0e
KW
60qr/(?[[[:word]]])/;
61EXPECT
737a7c2c
KW
62Assuming NOT a POSIX class since there is no terminating ':' in regex; marked by <-- HERE in m/(?[[[:word <-- HERE ]]])/ at - line 3.
63Unexpected ']' with no following ')' in (?[... in regex; marked by <-- HERE in m/(?[[[:word]] <-- HERE ])/ at - line 3.
46d34d0e
KW
64########
65# NAME qr/(?[ [[:digit: ])/
66# OPTION fatal
60ee17b9 67use warnings;
46d34d0e
KW
68qr/(?[[[:digit: ])/;
69EXPECT
737a7c2c
KW
70Assuming NOT a POSIX class since no blanks are allowed in one in regex; marked by <-- HERE in m/(?[[[:digit: ] <-- HERE )/ at - line 3.
71syntax error in (?[...]) in regex; marked by <-- HERE in m/(?[[[:digit: ]) <-- HERE / at - line 3.
46d34d0e
KW
72########
73# NAME qr/(?[ [:digit: ])/
74# OPTION fatal
60ee17b9 75use warnings;
46d34d0e
KW
76qr/(?[[:digit: ])/
77EXPECT
737a7c2c
KW
78Assuming NOT a POSIX class since no blanks are allowed in one in regex; marked by <-- HERE in m/(?[[:digit: ] <-- HERE )/ at - line 3.
79syntax error in (?[...]) in regex; marked by <-- HERE in m/(?[[:digit: ]) <-- HERE / at - line 3.
ca76e4e9
KW
80########
81# NAME [perl #126141]
82# OPTION fatal
83eval {/$_/}, print "$_ ==> ", $@ || "OK!\n" for "]]]]]]]]][\\", "]]]]][\\"
84EXPECT
85]]]]]]]]][\ ==> Unmatched [ in regex; marked by <-- HERE in m/]]]]]]]]][\ <-- HERE / at - line 2.
86]]]]][\ ==> Unmatched [ in regex; marked by <-- HERE in m/]]]]][\ <-- HERE / at - line 2.
d8d26cac
KW
87########
88# NAME [perl #123417]
d8d26cac 89# OPTION fatal
d8d26cac
KW
90qr/[\N{}]/;
91EXPECT
be332ba0
KW
92Unknown charname '' at - line 2, within pattern
93Execution of - aborted due to compilation errors.
d8d26cac
KW
94########
95# NAME [perl #123417]
96# OPTION fatal
d8d26cac
KW
97qr/\N{}/;
98EXPECT
be332ba0
KW
99Unknown charname '' at - line 2, within pattern
100Execution of - aborted due to compilation errors.
c2b4244a
A
101########
102# NAME [perl #131868]
103use warnings;
104my $qr = qr {
105 (?(DEFINE)
106 (?<digit> [0-9])
107 (?<digits> (?&digit){4})
108 )
109 ^(?&digits)$
110}x;
111EXPECT
112########
eb761011
KW
113# NAME Warn on 32-bit code points
114# SKIP ? $Config{uvsize} < 8
115use warnings 'portable';
116qr/\x{8000_0000}/;
117qr/[\x{8000_0000}]/;
118qr/\o{20_000_000_000}/;
119qr/[\o{20_000_000_000}]/;
120EXPECT
121Code point 0x80000000 is not Unicode, requires a Perl extension, and so is not portable in regex; marked by <-- HERE in m/\x{8000_0000} <-- HERE / at - line 2.
122Code point 0x80000000 is not Unicode, requires a Perl extension, and so is not portable in regex; marked by <-- HERE in m/[\x{8000_0000} <-- HERE ]/ at - line 3.
123Code point 0x80000000 is not Unicode, requires a Perl extension, and so is not portable in regex; marked by <-- HERE in m/\o{20_000_000_000} <-- HERE / at - line 4.
124Code point 0x80000000 is not Unicode, requires a Perl extension, and so is not portable in regex; marked by <-- HERE in m/[\o{20_000_000_000} <-- HERE ]/ at - line 5.