diff options
author | Mike Guy <mjtg@cam.ac.uk> | 2000-08-13 14:45:51 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-08-13 15:09:16 +0000 |
commit | 69f2e79da25b5a49598cf5c7f87472a2f9d99f7b (patch) | |
tree | 6594ad47ab12fe09f12918e579f81c33a225a471 /t | |
parent | 11860a173c6e967e36f57cd74b1c0a750da70751 (diff) | |
download | perl-69f2e79da25b5a49598cf5c7f87472a2f9d99f7b.tar.gz |
t/op/regmesg.t fails if REG_INFTY set
Message-Id: <E13Nx9D-00027M-00@libra.cus.cam.ac.uk>
p4raw-id: //depot/perl@6610
Diffstat (limited to 't')
-rw-r--r-- | t/op/regmesg.t | 53 |
1 files changed, 20 insertions, 33 deletions
diff --git a/t/op/regmesg.t b/t/op/regmesg.t index fa22c0649b..63b714f187 100644 --- a/t/op/regmesg.t +++ b/t/op/regmesg.t @@ -19,6 +19,11 @@ my $marker2 = " <<<HERE<<< "; ## ## Key-value pairs of code/error of code that should have fatal errors. ## + +eval 'use Config'; # assume defaults if fail +our %Config; +my $inf_m1 = ($Config{reg_infty} || 32767) - 1; +my $inf_p1 = $inf_m1 + 2; my @death = ( '/[[=foo=]]/' => 'POSIX syntax [= =] is reserved for future extensions at {#} mark in regex m/[[=foo=]{#}]/', @@ -44,7 +49,7 @@ my @death = '/((x)/' => 'Unmatched ( at {#} mark in regex m/({#}(x)/', - '/x{99999}/' => 'Quantifier in {,} bigger than 32766 at {#} mark in regex m/x{{#}99999}/', + "/x{$inf_p1}/" => "Quantifier in {,} bigger than $inf_m1 at {#} mark in regex m/x{{#}$inf_p1}/", '/x{3,1}/' => 'Can\'t do {n,m} with n > m at {#} mark in regex m/x{3,1}{#}/', @@ -106,28 +111,17 @@ while (@death) my $regex = shift @death; my $result = shift @death; - undef $@; $_ = "x"; eval $regex; if (not $@) { - if ($debug) { - print "oops, $regex didn't die\n" - } else { - print "not ok $count\n"; - } + print "# oops, $regex didn't die\nnot ok $count\n"; next; } chomp $@; - $@ =~ s/ at \(.*?\) line \d+\.$//; $result =~ s/{\#}/$marker1/; $result =~ s/{\#}/$marker2/; - if ($@ ne $result) { - if ($debug) { - print "For $regex, expected:\n $result\nGot:\n $@\n\n"; - } else { - print "not ok $count\n"; - } - next; + if ($@ !~ /^\Q$result/) { + print "# For $regex, expected:\n# $result\n# Got:\n# $@\n#\nnot "; } print "ok $count\n"; } @@ -148,34 +142,27 @@ while (@warning) if ($@) { - if ($debug) { - print "oops, $regex died with:\n\t$@\n"; - } else { - print "not ok $count\n"; - } + print "# oops, $regex died with:\n#\t$@#\nnot ok $count\n"; next; } if (not $warning) { - if ($debug) { - print "oops, $regex didn't generate a warning\n"; - } else { - print "not ok $count\n"; - } + print "# oops, $regex didn't generate a warning\nnot ok $count\n"; next; } - chomp $warning; - $warning =~ s/ at \(.*?\) line \d+\.$//; $result =~ s/{\#}/$marker1/; $result =~ s/{\#}/$marker2/; - if ($warning ne $result) + if ($warning !~ /^\Q$result/) { - if ($debug) { - print "For $regex, expected:\n $result\nGot:\n $warning\n\n"; - } else { - print "not ok $count\n"; - } + print <<"EOM"; +# For $regex, expected: +# $result +# Got: +# $warning +# +not ok $count +EOM next; } print "ok $count\n"; |