|
From: <jgr...@us...> - 2003-07-26 14:42:21
|
Update of /cvsroot/popfile/engine
In directory sc8-pr-cvs1:/tmp/cvs-serv10899
Modified Files:
coverage.pl
Log Message:
Added writing of HTML files for each file with coverage information coloring unexecuted lines red to make it easy to spot code for which we need tests
Index: coverage.pl
===================================================================
RCS file: /cvsroot/popfile/engine/coverage.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** coverage.pl 21 Jul 2003 19:53:36 -0000 1.4
--- coverage.pl 26 Jul 2003 14:42:18 -0000 1.5
***************
*** 85,86 ****
--- 85,115 ----
}
+ print "\nCreating HTML coverage files...\n\n";
+
+ foreach my $file (sort {$files{$b} <=> $files{$a}} keys %files) {
+
+ my $clean = $file;
+ $clean =~ s/^\.\.\/\///;
+
+ open HTML, ">../$clean.html";
+ open FILE, "<../$clean.pm";
+
+ print HTML "<html><head><title>$clean.pm</title></head><body><pre>";
+
+ my $line = 0;
+
+ while ( <FILE> ) {
+ $line += 1;
+ my $color = (defined($count{$file}{executed}{$line}) && ($count{$file}{executed}{$line}==0))?"red":"green";
+ my $block = ($color eq 'red')?"red":"white";
+ print HTML "<span style=\"background: $block\"> </span><font color=$color>$_</font>";
+ }
+
+ print HTML "</pre></body></html>";
+
+ close FILE;
+ close HTML;
+
+ print "Saved coverage view for $clean.pm in $clean.html\n";
+ }
+
|