This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/test.pl fresh_perl_like() bug
authorhv@crypt.org <hv@crypt.org>
Sat, 5 Dec 2009 00:50:02 +0000 (18:50 -0600)
committerCraig A. Berry <craigberry@mac.com>
Sat, 5 Dec 2009 00:51:40 +0000 (18:51 -0600)
The existing code does the wrong thing if a string (rather than a compiled
regexp) is supplied for $expected. Happily perl will do the right thing
if you let it.

Hugo

Message-Id: <200912041444.nB4EiqBj004436@zen.crypt.org>

t/test.pl

index bb27794..c0406b0 100644 (file)
--- a/t/test.pl
+++ b/t/test.pl
@@ -738,9 +738,7 @@ sub fresh_perl_like {
     my($prog, $expected, $runperl_args, $name) = @_;
     local $Level = 2;
     _fresh_perl($prog,
     my($prog, $expected, $runperl_args, $name) = @_;
     local $Level = 2;
     _fresh_perl($prog,
-               sub { @_ ?
-                         $_[0] =~ (ref $expected ? $expected : /$expected/) :
-                         $expected },
+               sub { @_ ? $_[0] =~ $expected : $expected },
                $runperl_args, $name);
 }
 
                $runperl_args, $name);
 }