From: Jarkko Hietaniemi Date: Sun, 27 Jul 2003 19:45:22 +0000 (+0000) Subject: fresh_perl_(is|like) were printing out the wrong file/line X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dcc7f48117e0d8d95c3ad7e7d270188fbf5e9ec8;p=p5sagit%2Fp5-mst-13.2.git fresh_perl_(is|like) were printing out the wrong file/line number on failure because _where() was hard coded to only look one level up the call stack. In these cases it has to look two. (Schwern) p4raw-id: //depot/perl@20240 --- diff --git a/t/test.pl b/t/test.pl index 81605f5..52fefbf 100644 --- a/t/test.pl +++ b/t/test.pl @@ -2,6 +2,7 @@ # t/test.pl - most of Test::More functionality without the fuss # +$Level = 1; my $test = 1; my $planned; @@ -76,7 +77,7 @@ sub _ok { } sub _where { - my @caller = caller(1); + my @caller = caller($Level); return "at $caller[1] line $caller[2]"; } @@ -585,6 +586,7 @@ sub _fresh_perl { sub fresh_perl_is { my($prog, $expected, $runperl_args, $name) = @_; + local $Level = 2; _fresh_perl($prog, sub { @_ ? $_[0] eq $expected : $expected }, $runperl_args, $name); @@ -598,6 +600,7 @@ sub fresh_perl_is { sub fresh_perl_like { my($prog, $expected, $runperl_args, $name) = @_; + local $Level = 2; _fresh_perl($prog, sub { @_ ? $_[0] =~ (ref $expected ? $expected : /$expected/) :