MCPcopy
hub / github.com/nwutils/nw-sample-apps / runTests

Function runTests

mini-code-edit/cm/test/test.js:302–322  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

300}
301
302function 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
324function eq(a, b, msg) {
325 if (a != b) throw new Failure(a + " != " + b + (msg ? " (" + msg + ")" : ""));

Callers

nothing calls this directly

Calls 2

forEachFunction · 0.70
htmlEscapeFunction · 0.70

Tested by

no test coverage detected