Fix assertion.

This commit is contained in:
ccd0 2016-04-12 20:48:02 -07:00
parent e2aaefa7df
commit 6b75bbbc00
2 changed files with 3 additions and 3 deletions

View File

@ -74,7 +74,7 @@ Linkify =
if Linkify.regString.test word
links.push Linkify.makeRange node, endNode, index, length
<%= assert('word is links[links.length-1].toString()') %>
<%= assert('.tests_enabled', 'word is links[links.length-1].toString()') %>
break unless test.lastIndex and node is endNode

View File

@ -161,8 +161,8 @@ obj.html = function(template) {
return `(innerHTML: ${output})`;
};
obj.assert = function(statement) {
if (!obj.tests_enabled) return '';
obj.assert = function(flagFile, statement) {
if (!readJSON(flagFile)) return '';
return `throw new Error 'Assertion failed: ' + ${constExpression(statement)} unless ${statement}`;
};