diff options
author | Hugo van der Sanden <hv@crypt.org> | 2001-06-21 01:29:07 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-20 23:27:57 +0000 |
commit | 27c93d935afa469df9d5f684ca7568352ce9242b (patch) | |
tree | 775a4bf9e6a41fd6dd5649213e55c531a4254705 /t/op/study.t | |
parent | 974c90c5029395da8217586c87921d37914f57c1 (diff) | |
download | perl-27c93d935afa469df9d5f684ca7568352ce9242b.tar.gz |
op/study.t refinements
Message-Id: <200106202329.AAA31397@crypt.compulink.co.uk>
p4raw-id: //depot/perl@10766
Diffstat (limited to 't/op/study.t')
-rwxr-xr-x | t/op/study.t | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/t/op/study.t b/t/op/study.t index a7f24f6224..348de79ab5 100755 --- a/t/op/study.t +++ b/t/op/study.t @@ -1,6 +1,9 @@ #!./perl -# $RCSfile: study.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:30 $ +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} print "1..26\n"; @@ -68,32 +71,28 @@ 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 +# [ID 20010618.006] tests 25..26 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"; - } + my $have_alarm = $Config{d_alarm}; + local $SIG{ALRM} = sub { die "timeout\n" }; + + $_ = 'FGF'; + study; + my $ok = $have_alarm + ? eval { alarm(2); my $match = /G.F$/; alarm(0); !$match } + : eval { !/G.F$/ }; + if ($ok && !$@) { + print "ok 25\n"; + } else { + print "not ok 25\t# " . $@ || "should not match\n"; + } + $ok = $have_alarm + ? eval { alarm(2); my $match = /[F]F$/; alarm(0); !$match } + : eval { !/[F]F$/ }; + if ($ok && !$@) { + print "ok 26\n"; } else { - for (25..26) { - print "ok $_ # Skip: no alarm\n"; - } + print "not ok 26\t# " . $@ || "should not match\n"; } } |