summaryrefslogtreecommitdiffstats
path: root/contrib/perl5/t/pragma/warn/regcomp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/perl5/t/pragma/warn/regcomp')
-rw-r--r--contrib/perl5/t/pragma/warn/regcomp165
1 files changed, 165 insertions, 0 deletions
diff --git a/contrib/perl5/t/pragma/warn/regcomp b/contrib/perl5/t/pragma/warn/regcomp
new file mode 100644
index 0000000..5d0c291
--- /dev/null
+++ b/contrib/perl5/t/pragma/warn/regcomp
@@ -0,0 +1,165 @@
+ regcomp.c AOK
+
+ Strange *+?{} on zero-length expression [S_study_chunk]
+ /(?=a)?/
+
+ %.*s matches null string many times [S_regpiece]
+ $a = "ABC123" ; $a =~ /(?=a)*/'
+
+ /%.127s/: Unrecognized escape \\%c passed through [S_regatom]
+ $x = '\m' ; /$x/
+
+ Character class [:%.*s:] unknown [S_regpposixcc]
+
+ Character class syntax [. .] is reserved for future extensions [S_regpposixcc]
+
+ Character class syntax [= =] is reserved for future extensions [S_checkposixcc]
+
+ Character class syntax [%c %c] belongs inside character classes [S_checkposixcc]
+
+ /%.127s/: false [] range \"%*.*s\" in regexp [S_regclass]
+
+ /%.127s/: false [] range \"%*.*s\" in regexp [S_regclassutf8]
+
+ /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclass]
+
+ /%.127s/: Unrecognized escape \\%c in character class passed through" [S_regclassutf8]
+
+__END__
+# regcomp.c [S_regpiece]
+use warnings 'regexp' ;
+my $a = "ABC123" ;
+$a =~ /(?=a)*/ ;
+no warnings 'regexp' ;
+$a =~ /(?=a)*/ ;
+EXPECT
+(?=a)* matches null string many times at - line 4.
+########
+# regcomp.c [S_study_chunk]
+use warnings 'regexp' ;
+$_ = "" ;
+/(?=a)?/;
+no warnings 'regexp' ;
+/(?=a)?/;
+EXPECT
+Strange *+?{} on zero-length expression at - line 4.
+########
+# regcomp.c [S_regatom]
+$x = '\m' ;
+use warnings 'regexp' ;
+$a =~ /a$x/ ;
+no warnings 'regexp' ;
+$a =~ /a$x/ ;
+EXPECT
+/a\m/: Unrecognized escape \m passed through at - line 4.
+########
+# regcomp.c [S_regpposixcc S_checkposixcc]
+BEGIN { $ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3 }
+use warnings 'regexp' ;
+$_ = "" ;
+/[:alpha:]/;
+/[.bar.]/;
+/[=zog=]/;
+/[[:alpha:]]/;
+/[[.foo.]]/;
+/[[=bar=]]/;
+/[:zog:]/;
+/[[:zog:]]/;
+no warnings 'regexp' ;
+/[:alpha:]/;
+/[.foo.]/;
+/[=bar=]/;
+/[[:alpha:]]/;
+/[[.foo.]]/;
+/[[=bar=]]/;
+/[[:zog:]]/;
+/[:zog:]/;
+EXPECT
+Character class syntax [: :] belongs inside character classes at - line 5.
+Character class syntax [. .] belongs inside character classes at - line 6.
+Character class syntax [. .] is reserved for future extensions at - line 6.
+Character class syntax [= =] belongs inside character classes at - line 7.
+Character class syntax [= =] is reserved for future extensions at - line 7.
+Character class syntax [. .] is reserved for future extensions at - line 9.
+Character class syntax [= =] is reserved for future extensions at - line 10.
+Character class syntax [: :] belongs inside character classes at - line 11.
+Character class [:zog:] unknown at - line 12.
+########
+# regcomp.c [S_regclass]
+$_ = "";
+use warnings 'regexp' ;
+/[a-b]/;
+/[a-\d]/;
+/[\d-b]/;
+/[\s-\d]/;
+/[\d-\s]/;
+/[a-[:digit:]]/;
+/[[:digit:]-b]/;
+/[[:alpha:]-[:digit:]]/;
+/[[:digit:]-[:alpha:]]/;
+no warnings 'regexp' ;
+/[a-b]/;
+/[a-\d]/;
+/[\d-b]/;
+/[\s-\d]/;
+/[\d-\s]/;
+/[a-[:digit:]]/;
+/[[:digit:]-b]/;
+/[[:alpha:]-[:digit:]]/;
+/[[:digit:]-[:alpha:]]/;
+EXPECT
+/[a-\d]/: false [] range "a-\d" in regexp at - line 5.
+/[\d-b]/: false [] range "\d-" in regexp at - line 6.
+/[\s-\d]/: false [] range "\s-" in regexp at - line 7.
+/[\d-\s]/: false [] range "\d-" in regexp at - line 8.
+/[a-[:digit:]]/: false [] range "a-[:digit:]" in regexp at - line 9.
+/[[:digit:]-b]/: false [] range "[:digit:]-" in regexp at - line 10.
+/[[:alpha:]-[:digit:]]/: false [] range "[:alpha:]-" in regexp at - line 11.
+/[[:digit:]-[:alpha:]]/: false [] range "[:digit:]-" in regexp at - line 12.
+########
+# regcomp.c [S_regclassutf8]
+BEGIN {
+ if (ord("\t") == 5) {
+ print "SKIPPED\n# ebcdic regular expression ranges differ.";
+ exit 0;
+ }
+}
+use utf8;
+$_ = "";
+use warnings 'regexp' ;
+/[a-b]/;
+/[a-\d]/;
+/[\d-b]/;
+/[\s-\d]/;
+/[\d-\s]/;
+/[a-[:digit:]]/;
+/[[:digit:]-b]/;
+/[[:alpha:]-[:digit:]]/;
+/[[:digit:]-[:alpha:]]/;
+no warnings 'regexp' ;
+/[a-b]/;
+/[a-\d]/;
+/[\d-b]/;
+/[\s-\d]/;
+/[\d-\s]/;
+/[a-[:digit:]]/;
+/[[:digit:]-b]/;
+/[[:alpha:]-[:digit:]]/;
+/[[:digit:]-[:alpha:]]/;
+EXPECT
+/[a-\d]/: false [] range "a-\d" in regexp at - line 12.
+/[\d-b]/: false [] range "\d-" in regexp at - line 13.
+/[\s-\d]/: false [] range "\s-" in regexp at - line 14.
+/[\d-\s]/: false [] range "\d-" in regexp at - line 15.
+/[a-[:digit:]]/: false [] range "a-[:digit:]" in regexp at - line 16.
+/[[:digit:]-b]/: false [] range "[:digit:]-" in regexp at - line 17.
+/[[:alpha:]-[:digit:]]/: false [] range "[:alpha:]-" in regexp at - line 18.
+/[[:digit:]-[:alpha:]]/: false [] range "[:digit:]-" in regexp at - line 19.
+########
+# regcomp.c [S_regclass S_regclassutf8]
+use warnings 'regexp' ;
+$a =~ /[a\zb]/ ;
+no warnings 'regexp' ;
+$a =~ /[a\zb]/ ;
+EXPECT
+/[a\zb]/: Unrecognized escape \z in character class passed through at - line 3.
OpenPOWER on IntegriCloud