From: Vincent Pit Date: Mon, 10 Sep 2012 09:12:55 +0000 (+0200) Subject: Make t/63-uplevel-ctl.t pass with the debugger enabled X-Git-Tag: v0.20~16 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FScope-Upper.git;a=commitdiff_plain;h=315828816488ed369d36100fa7d59d31de3ed302 Make t/63-uplevel-ctl.t pass with the debugger enabled --- diff --git a/t/63-uplevel-ctl.t b/t/63-uplevel-ctl.t index 6b1ec18..3a6c5d6 100644 --- a/t/63-uplevel-ctl.t +++ b/t/63-uplevel-ctl.t @@ -77,7 +77,8 @@ is do { local $@; eval { depth() } }, 1, 'check eval block depth'; }->(); fail "$desc: not reached 2"; ]; - like $@, qr/^onion at \(eval \d+\) line 8/, "$desc: correct exception"; + my $loc = $^P ? "[$0:" . (__LINE__-14) . ']' : ''; + like $@, qr/^onion at \(eval \d+\)\Q$loc\E line 8/, "$desc: correct exception"; } { @@ -145,7 +146,9 @@ is do { local $@; eval { depth() } }, 1, 'check eval block depth'; }->(); fail "$desc: not reached 3"; }; - like $@, qr/^ravioli at \(eval \d+\) line 7/, "$desc: correct exception"; + my $loc = $^P ? "[$0:" . (__LINE__-15) . ']' : ''; + like $@, qr/^ravioli at \(eval \d+\)\Q$loc\E line 7/, + "$desc: correct exception"; } our $hurp; @@ -318,8 +321,9 @@ sub clash { &uplevel(\&uplevel => \1, HERE); }->(); }; - my $line = __LINE__-2; # The error happens at the target frame. + my $line = $^P ? '\d+' : __LINE__-2; # The error happens at the target frame. + my $file = $^P ? '\S+' : quotemeta $0; like $@, - qr/^First argument to uplevel must be a code reference at \Q$0\E line $line/, + qr/^First argument to uplevel must be a code reference at $file line $line/, "$desc: correct error"; }