Verified Commit 9fd204ee authored by Camil Staps's avatar Camil Staps 🙂

Test script enhancements

parent b94f0437
......@@ -87,11 +87,16 @@ var htmlResults;
function runTestCase(testcase) {
var f = undefined;
var profile = process.hrtime();
var result = highlightClean(testcase.test, function(span,cls,str){return span}, testcase.entry);
var profile = process.hrtime(profile);
result = parseResult(result);
var passed = result == testcase.result;
var time_spent = profile[0] * 1000000 + profile[1] / 1000;
time_spent = (time_spent / 1000).toFixed(3) + 'ms';
htmlResults += '<tr class="testcase ' + (passed ? 'passed' : 'failed') + '">';
htmlResults += '<td>' + testcase.name + '</td>';
htmlResults += '<td><pre>' + resultToHTML(testcase.result) + '</pre>';
......@@ -99,10 +104,10 @@ function runTestCase(testcase) {
htmlResults += '<pre>' + resultToHTML(result) + '</pre>';
htmlResults += '</td></tr>';
if (passed) {
process.stderr.write(GREEN + testcase.name + ' passed.' + RESET + '\n');
} else {
process.stderr.write(RED + testcase.name + ' failed.' + RESET + '\n');
process.stderr.write(testcase.name +
(passed ? GREEN + ' passed' : RED + ' failed') + RESET +
' ('+ time_spent + ').\n');
if (!passed) {
process.exitCode = 1;
var patch = jsdiff.createPatch(testcase.name + '.result',
testcase.result, result,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment