mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 08:08:00 +01:00
:retab regressions.js - nasty.
This commit is contained in:
@@ -99,18 +99,18 @@ commands.addUserCommand(["regr[essions]"],
|
||||
|
||||
function run ()
|
||||
{
|
||||
let now = Date.now();
|
||||
let now = Date.now();
|
||||
let totalTests = tests.length + functions.length;
|
||||
let successfulTests = 0;
|
||||
let successfulTests = 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
|
||||
for (let [, test] in Iterator(tests))
|
||||
{
|
||||
currentTest++;
|
||||
if (count >= 1 && currentTest != count)
|
||||
continue;
|
||||
for (let [, test] in Iterator(tests))
|
||||
{
|
||||
currentTest++;
|
||||
if (count >= 1 && currentTest != count)
|
||||
continue;
|
||||
|
||||
let testDescription = util.clip(test.cmds.join(" -> "), 80);
|
||||
liberator.echomsg("Running test " + currentTest + " of " + totalTests + ": " + testDescription);
|
||||
@@ -127,27 +127,27 @@ commands.addUserCommand(["regr[essions]"],
|
||||
|
||||
if (!test.verify())
|
||||
liberator.echoerr("Test " + currentTest + " failed: " + testDescription);
|
||||
else
|
||||
successfulTests++;
|
||||
else
|
||||
successfulTests++;
|
||||
}
|
||||
|
||||
// 2.) Run function tests
|
||||
for (let [, func] in Iterator(functions))
|
||||
{
|
||||
currentTest++;
|
||||
if (count >= 1 && currentTest != count)
|
||||
continue;
|
||||
for (let [, func] in Iterator(functions))
|
||||
{
|
||||
currentTest++;
|
||||
if (count >= 1 && currentTest != count)
|
||||
continue;
|
||||
|
||||
liberator.echomsg("Running test " + currentTest + " of " + totalTests + ": " + util.clip(func.toString().replace(/[\s\n]+/gm, " "), 80));
|
||||
Tests.resetEnvironment();
|
||||
|
||||
if (!func())
|
||||
liberator.echoerr("Test " + currentTest + " failed!");
|
||||
else
|
||||
successfulTests++;
|
||||
else
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -158,8 +158,8 @@ commands.addUserCommand(["regr[essions]"],
|
||||
},
|
||||
{
|
||||
bang: true,
|
||||
argCount: 0,
|
||||
count: true
|
||||
argCount: 0,
|
||||
count: true
|
||||
});
|
||||
|
||||
// vimperator: set et ts=4 sw=4 :
|
||||
|
||||
Reference in New Issue
Block a user