summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJeff Pinyan <japhy@pobox.com>2001-06-01 06:33:55 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-01 15:39:52 +0000
commit9d1d55b5374182f02a1e09f458fc91bfe389e6cc (patch)
tree6afa881945b2caee16f8928d754c95bd4297d400 /t
parent1b96318cf20a01b551ac8519bf1ee01be2296d37 (diff)
downloadperl-9d1d55b5374182f02a1e09f458fc91bfe389e6cc.tar.gz
Re: [PATCHES] regcomp.c, pod/perldiag.pod, t/op/pat.t
Message-ID: <Pine.GSO.4.21.0106011032080.21027-100000@crusoe.crusoe.net> p4raw-id: //depot/perl@10376
Diffstat (limited to 't')
-rwxr-xr-xt/op/pat.t60
1 files changed, 59 insertions, 1 deletions
diff --git a/t/op/pat.t b/t/op/pat.t
index 0df4d786ee..ab4226ca21 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -6,7 +6,7 @@
$| = 1;
-print "1..615\n";
+print "1..625\n";
BEGIN {
chdir 't' if -d 't';
@@ -1685,3 +1685,61 @@ EOT
print "ok 615\n";
}
+{
+ # from japhy
+ my $w;
+ use warnings;
+ local $SIG{__WARN__} = sub { $w .= shift };
+
+ $w = "";
+ eval 'qr/(?c)/';
+ print "not " if $w !~ /^Useless \(\?c\)/;
+ print "ok 616\n";
+
+ $w = "";
+ eval 'qr/(?-c)/';
+ print "not " if $w !~ /^Useless \(\?-c\)/;
+ print "ok 617\n";
+
+ $w = "";
+ eval 'qr/(?g)/';
+ print "not " if $w !~ /^Useless \(\?g\)/;
+ print "ok 618\n";
+
+ $w = "";
+ eval 'qr/(?-g)/';
+ print "not " if $w !~ /^Useless \(\?-g\)/;
+ print "ok 619\n";
+
+ $w = "";
+ eval 'qr/(?o)/';
+ print "not " if $w !~ /^Useless \(\?o\)/;
+ print "ok 620\n";
+
+ $w = "";
+ eval 'qr/(?-o)/';
+ print "not " if $w !~ /^Useless \(\?-o\)/;
+ print "ok 621\n";
+
+ # now test multi-error regexes
+
+ $w = "";
+ eval 'qr/(?g-o)/';
+ print "not " if $w !~ /^Useless \(\?g\).*\nUseless \(\?-o\)/;
+ print "ok 622\n";
+
+ $w = "";
+ eval 'qr/(?g-c)/';
+ print "not " if $w !~ /^Useless \(\?g\).*\nUseless \(\?-c\)/;
+ print "ok 623\n";
+
+ $w = "";
+ eval 'qr/(?o-cg)/'; # (?c) means (?g) error won't be thrown
+ print "not " if $w !~ /^Useless \(\?o\).*\nUseless \(\?-c\)/;
+ print "ok 624\n";
+
+ $w = "";
+ eval 'qr/(?ogc)/';
+ print "not " if $w !~ /^Useless \(\?o\).*\nUseless \(\?g\).*\nUseless \(\?c\)/;
+ print "ok 625\n";
+}