diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-20 13:57:27 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-20 13:57:27 +0000 |
commit | 0dec986a3fdc9a52abdf7d1390936c6b308b8643 (patch) | |
tree | d140501e3b73f55ec66f7f38b290c14a173236fa /t | |
parent | 03d70c897754d6af90de9d0ffe2857d000d6f2d7 (diff) | |
download | perl-0dec986a3fdc9a52abdf7d1390936c6b308b8643.tar.gz |
Reinstate #10725 (with probe for alarm()).
p4raw-id: //depot/perl@10751
Diffstat (limited to 't')
-rwxr-xr-x | t/op/study.t | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/t/op/study.t b/t/op/study.t index ea3b366f0b..a7f24f6224 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,33 @@ 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 +{ + use Config; + if ($Config{d_alarm}) { + 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"; + } + } else { + for (25..26) { + print "ok $_ # Skip: no alarm\n"; + } + } +} |