Permalink
Browse files

recursively unwrap evals to fix some condition coverage gaps

  • Loading branch information...
1 parent fcfcb96 commit c8034dc35bd9b55ba82657e5cdd9a1eea9f1fe18 @wchristian wchristian committed Oct 15, 2011
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/Devel/Cover.pm
View
12 lib/Devel/Cover.pm
@@ -512,7 +512,9 @@ sub get_location
# warn "${File}::$Line\n";
# If there's an eval, get the real filename. Enabled from $^P & 0x100.
- ($File, $Line) = ($1, $2) if $File =~ /^\(eval \d+\)\[(.*):(\d+)\]/;
+ while ($File =~ /^\(eval \d+\)\[(.*):(\d+)\]/) {
+ ($File, $Line) = ($1, $2);
+ }
$File = normalised_file($File);
if (!exists $Run{vec}{$File} && $Run{collected})
@@ -533,8 +535,12 @@ sub use_file
# die "bad file" unless length $file;
- $file = $1 if $file =~ /^\(eval \d+\)\[(.+):\d+\]/;
- $file = $1 if $file =~ /^\(eval in \w+\) (.+)/;
+ while ($file =~ /^\(eval \d+\)\[(.+):\d+\]/) {
+ $file = $1;
+ }
+ while ($file =~ /^\(eval in \w+\) (.+)/) {
+ $file = $1;
+ }
$file =~ s/ \(autosplit into .*\)$//;
return $Files{$file} if exists $Files{$file};

0 comments on commit c8034dc

Please sign in to comment.