From: Robert Konigsberg Date: Fri, 15 Jun 2012 15:21:02 +0000 (-0400) Subject: Add failure count to top of file. X-Git-Tag: v1.0.0~238^2^2~19 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=825a47fc3dec99c3f8351d598d4dec34081be43a;p=dygraphs.git Add failure count to top of file. --- diff --git a/auto_tests/misc/local.html b/auto_tests/misc/local.html index 076e3ec..a2bff4b 100644 --- a/auto_tests/misc/local.html +++ b/auto_tests/misc/local.html @@ -124,15 +124,16 @@ } } resultsDiv = createResultsDiv(); - postResults(results); + var failures = postResults(results); resultsDiv.appendChild(document.createElement("hr")); + document.getElementById('summary').innerText = "(" + failures + " failures)"; } function createResultsDiv() { var body = document.getElementsByTagName("body")[0]; div = document.createElement("div"); div.id='results'; - div.innerHTML = "Test results: passed failed all
"; + div.innerHTML = "Test results: passed failed all
"; body.insertBefore(div, body.firstChild); var setByClassName = function(name, displayStyle) { @@ -167,6 +168,7 @@ return div; } + /* also returns an in representing sum of failures below. */ function postResults(results, title) { if (typeof(results) == "boolean") { var elem = document.createElement("div"); @@ -175,18 +177,21 @@ var prefix = title ? (title + ": ") : ""; elem.innerHTML = prefix + '' + (results ? 'pass' : 'fail') + ''; resultsDiv.appendChild(elem); + return results ? 0 : 1; } else { // hash + var failed = 0; var html = ""; for (var key in results) { if (results.hasOwnProperty(key)) { var elem = results[key]; if (typeof(elem) == "boolean" && title) { - postResults(results[key], title + "." + key); + failed += postResults(results[key], title + "." + key); } else { - postResults(results[key], key); + failed += postResults(results[key], key); } } } + return failed; } }