Skip to content
This repository
Browse code

recursively unwrap evals to fix some condition coverage gaps

  • Loading branch information...
commit c8034dc35bd9b55ba82657e5cdd9a1eea9f1fe18 1 parent fcfcb96
Christian Walde authored

Showing 1 changed file with 9 additions and 3 deletions. Show diff stats Hide diff stats

  1. 12  lib/Devel/Cover.pm
12  lib/Devel/Cover.pm
@@ -512,7 +512,9 @@ sub get_location
512 512
     # warn "${File}::$Line\n";
513 513
 
514 514
     # If there's an eval, get the real filename.  Enabled from $^P & 0x100.
515  
-    ($File, $Line) = ($1, $2) if $File =~ /^\(eval \d+\)\[(.*):(\d+)\]/;
  515
+    while ($File =~ /^\(eval \d+\)\[(.*):(\d+)\]/) {
  516
+        ($File, $Line) = ($1, $2);
  517
+    }
516 518
     $File = normalised_file($File);
517 519
 
518 520
     if (!exists $Run{vec}{$File} && $Run{collected})
@@ -533,8 +535,12 @@ sub use_file
533 535
 
534 536
     # die "bad file" unless length $file;
535 537
 
536  
-    $file = $1 if $file =~ /^\(eval \d+\)\[(.+):\d+\]/;
537  
-    $file = $1 if $file =~ /^\(eval in \w+\) (.+)/;
  538
+    while ($file =~ /^\(eval \d+\)\[(.+):\d+\]/) {
  539
+        $file = $1;
  540
+    }
  541
+    while ($file =~ /^\(eval in \w+\) (.+)/) {
  542
+        $file = $1;
  543
+    }
538 544
     $file =~ s/ \(autosplit into .*\)$//;
539 545
 
540 546
     return $Files{$file} if exists $Files{$file};

0 notes on commit c8034dc

Please sign in to comment.
Something went wrong with that request. Please try again.