1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 10:08:00 +01:00

:retab regressions.js - nasty.

This commit is contained in:
Doug Kearns
2008-11-25 05:14:45 +00:00
parent 19b1442305
commit b543359408

View File

@@ -99,18 +99,18 @@ commands.addUserCommand(["regr[essions]"],
function run () function run ()
{ {
let now = Date.now(); let now = Date.now();
let totalTests = tests.length + functions.length; let totalTests = tests.length + functions.length;
let successfulTests = 0; let successfulTests = 0;
let currentTest = 0; let currentTest = 0;
// TODO: might want to unify 'tests' and 'functions' handling // TODO: might want to unify 'tests' and 'functions' handling
// 1.) run commands and mappings tests // 1.) run commands and mappings tests
for (let [, test] in Iterator(tests)) for (let [, test] in Iterator(tests))
{ {
currentTest++; currentTest++;
if (count >= 1 && currentTest != count) if (count >= 1 && currentTest != count)
continue; continue;
let testDescription = util.clip(test.cmds.join(" -> "), 80); let testDescription = util.clip(test.cmds.join(" -> "), 80);
liberator.echomsg("Running test " + currentTest + " of " + totalTests + ": " + testDescription); liberator.echomsg("Running test " + currentTest + " of " + totalTests + ": " + testDescription);
@@ -127,27 +127,27 @@ commands.addUserCommand(["regr[essions]"],
if (!test.verify()) if (!test.verify())
liberator.echoerr("Test " + currentTest + " failed: " + testDescription); liberator.echoerr("Test " + currentTest + " failed: " + testDescription);
else else
successfulTests++; successfulTests++;
} }
// 2.) Run function tests // 2.) Run function tests
for (let [, func] in Iterator(functions)) for (let [, func] in Iterator(functions))
{ {
currentTest++; currentTest++;
if (count >= 1 && currentTest != count) if (count >= 1 && currentTest != count)
continue; continue;
liberator.echomsg("Running test " + currentTest + " of " + totalTests + ": " + util.clip(func.toString().replace(/[\s\n]+/gm, " "), 80)); liberator.echomsg("Running test " + currentTest + " of " + totalTests + ": " + util.clip(func.toString().replace(/[\s\n]+/gm, " "), 80));
Tests.resetEnvironment(); Tests.resetEnvironment();
if (!func()) if (!func())
liberator.echoerr("Test " + currentTest + " failed!"); liberator.echoerr("Test " + currentTest + " failed!");
else else
successfulTests++; successfulTests++;
} }
liberator.echomsg(successfulTests + " of " + (count >= 1 ? 1 : totalTests) + " tests successfully completed in " + ((Date.now() - now) / 1000.0) + " msec"); liberator.echomsg(successfulTests + " of " + (count >= 1 ? 1 : totalTests) + " tests successfully completed in " + ((Date.now() - now) / 1000.0) + " msec");
liberator.execute(":messages"); liberator.execute(":messages");
} }
@@ -158,8 +158,8 @@ commands.addUserCommand(["regr[essions]"],
}, },
{ {
bang: true, bang: true,
argCount: 0, argCount: 0,
count: true count: true
}); });
// vimperator: set et ts=4 sw=4 : // vimperator: set et ts=4 sw=4 :