Skip to content

Commit

Permalink
Use a strict comparison and loop over all the lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kami committed May 1, 2011
1 parent ac49ea1 commit 3fe4046
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/coverage.js
Expand Up @@ -67,6 +67,7 @@ function coverage(data, val) {
}

function populateCoverage(cov) {
var linesLen;
var results = {};

results.LOC = 0;
Expand All @@ -93,12 +94,15 @@ function populateCoverage(cov) {
source: null
};

if (file_stats.lines == null) {
if (file_stats.lines === null) {
file_stats.lines = file.lines;
}
else {
for (var i = 0; i < file.lines; i++) {
if (file.lines[i]) file_stats.lines[i] += file.lines[i];
linesLen = file.lines.length;
for (var i = 0; i < linesLen; i++) {
if (file.lines[i] !== null) {
file_stats.lines[i] += file.lines[i];
}
}
}

Expand All @@ -107,7 +111,7 @@ function populateCoverage(cov) {
}

results.files[name] = file_stats;
}
}
}

/* Calculate statistics */
Expand Down

0 comments on commit 3fe4046

Please sign in to comment.