summaryrefslogtreecommitdiff
path: root/t/test.pl
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-07-27 19:45:22 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-07-27 19:45:22 +0000
commitdcc7f48117e0d8d95c3ad7e7d270188fbf5e9ec8 (patch)
treefbb2e8edc2fe701f49a1869b1d19dcdd52ca1e17 /t/test.pl
parent94c40caf430c7b27d6deb49a7d2887373dff1171 (diff)
downloadperl-dcc7f48117e0d8d95c3ad7e7d270188fbf5e9ec8.tar.gz
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
Diffstat (limited to 't/test.pl')
-rw-r--r--t/test.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/t/test.pl b/t/test.pl
index 81605f5958..52fefbf7ab 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/) :