don't require async tests to also return synchronously

This commit is contained in:
rolux 2012-05-27 17:00:18 +02:00
parent 54694e3d7e
commit f996a24ce2

View file

@ -558,26 +558,27 @@ Ox.test = function(file, callback) {
item.tests && item.tests.some(function(test) { item.tests && item.tests.some(function(test) {
return test.result; return test.result;
}) && item.tests.forEach(function(test) { }) && item.tests.forEach(function(test) {
Ox.Log('TEST', test.statement);
actual = eval(test.statement);
match = test.statement.match(/Ox\.test\.async\('([\w\.]+)'/); match = test.statement.match(/Ox\.test\.async\('([\w\.]+)'/);
if (match) { if (match) {
Ox.test.data[file].tests[match[1]] = { Ox.test.data[file].tests[match[1]] = {
section: item.section, section: item.section,
statement: test.statement statement: test.statement
}; };
} } else {
Ox.Log('TEST', test.statement); if (test.result) {
actual = eval(test.statement); Ox.test.data[file].results.push({
if (test.result) { actual: JSON.stringify(actual),
Ox.test.data[file].results.push({ expected: test.result,
actual: JSON.stringify(actual), name: item.name,
expected: test.result, section: item.section,
name: item.name, statement: test.statement,
section: item.section, passed: Ox.isEqual(eval(
statement: test.statement, '(' + test.result + ')'
passed: Ox.isEqual(eval( ), actual)
'(' + test.result + ')' });
), actual) }
});
} }
}); });
}); });