()
| 300 | } |
| 301 | |
| 302 | function runTests() { |
| 303 | var failures = [], run = 0; |
| 304 | for (var i = 0; i < tests.length; ++i) { |
| 305 | var test = tests[i]; |
| 306 | try {test.func();} |
| 307 | catch(e) { |
| 308 | if (e instanceof Failure) |
| 309 | failures.push({type: "failure", test: test.name, text: e.message}); |
| 310 | else |
| 311 | failures.push({type: "error", test: test.name, text: e.toString()}); |
| 312 | } |
| 313 | run++; |
| 314 | } |
| 315 | var html = [run + " tests run."]; |
| 316 | if (failures.length) |
| 317 | forEach(failures, function(fail) { |
| 318 | html.push(fail.test + ': <span class="' + fail.type + '">' + htmlEscape(fail.text) + "</span>"); |
| 319 | }); |
| 320 | else html.push('<span class="ok">All passed.</span>'); |
| 321 | document.getElementById("output").innerHTML = html.join("\n"); |
| 322 | } |
| 323 | |
| 324 | function eq(a, b, msg) { |
| 325 | if (a != b) throw new Failure(a + " != " + b + (msg ? " (" + msg + ")" : "")); |
nothing calls this directly
no test coverage detected