summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2001-06-19 13:37:30 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-19 17:28:30 +0000
commit4870b8cdda36a1b698c7fb131f1c51662c718f74 (patch)
tree057ae08fd927c28b310fbb1a0575fd5fcab4821d
parent0fe87f7cac1b476c6ed08653baf343a88f44d3b9 (diff)
downloadperl-4870b8cdda36a1b698c7fb131f1c51662c718f74.tar.gz
Re: [ID 20010618.006] some end-anchored regexps hang when using study
Message-Id: <200106191137.MAA15185@crypt.compulink.co.uk> p4raw-id: //depot/perl@10725
-rwxr-xr-xt/op/study.t25
1 files changed, 24 insertions, 1 deletions
diff --git a/t/op/study.t b/t/op/study.t
index ea3b366f0b..d08b8901e9 100755
--- a/t/op/study.t
+++ b/t/op/study.t
@@ -2,7 +2,7 @@
# $RCSfile: study.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:30 $
-print "1..24\n";
+print "1..26\n";
$x = "abc\ndef\n";
study($x);
@@ -67,3 +67,26 @@ if (/^$_$/) {print "ok 23\n";} else {print "not ok 23\n";}
$* = 1; # test 3 only tested the optimized version--this one is for real
if ("ab\ncd\n" =~ /^cd/) {print "ok 24\n";} else {print "not ok 24\n";}
+
+# [ID 20010618.006] these two may loop
+{
+ local $SIG{ALRM} = sub { die "timeout\n" };
+ $_ = 'FGF';
+ study;
+ my $ok = eval { alarm(2); my $match = /G.F$/; alarm(0); !$match };
+ if ($ok && !$@) {
+ print "ok 25\n";
+ } elsif ($@) {
+ print "not ok 25\t# $@";
+ } else {
+ print "not ok 25\t# should not match\n";
+ }
+ $ok = eval { alarm(2); my $match = /[F]F$/; alarm(0); !$match };
+ if ($ok && !$@) {
+ print "ok 26\n";
+ } elsif ($@) {
+ print "not ok 26\t# $@";
+ } else {
+ print "not ok 26\t# should not match\n";
+ }
+}