Skip to content
Snippets Groups Projects
Commit 03f8aaed authored by Marijn Haverbeke's avatar Marijn Haverbeke
Browse files

Make the tester accurately report total test count

Even when a subset is selected.
parent a2ad87f2
No related branches found
No related tags found
No related merge requests found
......@@ -48,10 +48,6 @@ function runTests(callback) {
}
if (debug.length < 1) {
debug = null;
} else {
if (totalTests > debug.length) {
totalTests = debug.length;
}
}
}
var totalTime = 0;
......@@ -67,7 +63,7 @@ function runTests(callback) {
// Remove from array for reporting incorrect tests later
debug.splice(debugIndex, 1);
} else {
var wildcardName = test.name.split("_").shift() + "_*";
var wildcardName = test.name.split("_")[0] + "_*";
debugIndex = indexOf(debug, wildcardName);
if (debugIndex !== -1) {
// Remove from array for reporting incorrect tests later
......@@ -75,11 +71,7 @@ function runTests(callback) {
debugUsed.push(wildcardName);
} else {
debugIndex = indexOf(debugUsed, wildcardName);
if (debugIndex !== -1) {
totalTests++;
} else {
return step(i + 1);
}
if (debugIndex == -1) return step(i + 1);
}
}
}
......@@ -132,3 +124,15 @@ function eqPos(a, b, msg) {
function is(a, msg) {
if (!a) throw new Failure(label("assertion failed", msg));
}
function countTests() {
if (!debug) return tests.length;
var sum = 0;
for (var i = 0; i < tests.length; ++i) {
var name = tests[i].name;
if (indexOf(debug, name) != -1 ||
indexOf(debug, name.split("_")[0] + "_*") != -1)
++sum;
}
return sum;
}
\ No newline at end of file
......@@ -107,7 +107,7 @@
bad = "";
verbose = false;
debugUsed = Array();
totalTests = tests.length;
totalTests = countTests();
progressTotal.nodeValue = " of " + totalTests;
progressRan.nodeValue = count;
output.innerHTML = '';
......@@ -141,8 +141,6 @@
var message = "???";
if (type != "done") ++count;
progress.style.width = (count * (progress.parentNode.clientWidth - 2) / totalTests) + "px";
progressTotal.nodeValue = " of " + totalTests +
(debugUsed.length && type != "done" ? "+" : "");
progressRan.nodeValue = count;
if (type == "ok") {
message = "Test '" + name + "' succeeded";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment