From f996a24ce2bc45c4b43c6e4fbfafc63b6146fd93 Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 27 May 2012 17:00:18 +0200 Subject: [PATCH] don't require async tests to also return synchronously --- source/Ox/js/JavaScript.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/source/Ox/js/JavaScript.js b/source/Ox/js/JavaScript.js index bfc26943..d54bb360 100644 --- a/source/Ox/js/JavaScript.js +++ b/source/Ox/js/JavaScript.js @@ -558,26 +558,27 @@ Ox.test = function(file, callback) { item.tests && item.tests.some(function(test) { return test.result; }) && item.tests.forEach(function(test) { + Ox.Log('TEST', test.statement); + actual = eval(test.statement); match = test.statement.match(/Ox\.test\.async\('([\w\.]+)'/); if (match) { Ox.test.data[file].tests[match[1]] = { section: item.section, statement: test.statement }; - } - Ox.Log('TEST', test.statement); - actual = eval(test.statement); - if (test.result) { - Ox.test.data[file].results.push({ - actual: JSON.stringify(actual), - expected: test.result, - name: item.name, - section: item.section, - statement: test.statement, - passed: Ox.isEqual(eval( - '(' + test.result + ')' - ), actual) - }); + } else { + if (test.result) { + Ox.test.data[file].results.push({ + actual: JSON.stringify(actual), + expected: test.result, + name: item.name, + section: item.section, + statement: test.statement, + passed: Ox.isEqual(eval( + '(' + test.result + ')' + ), actual) + }); + } } }); });