From 6b75bbbc00fc8deb3cbc90cebe69c47b7bd9f684 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 12 Apr 2016 20:48:02 -0700 Subject: [PATCH] Fix assertion. --- src/Linkification/Linkify.coffee | 2 +- tools/template.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index 2b67337c8..f531be459 100644 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -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 diff --git a/tools/template.js b/tools/template.js index fdd439c28..49792f7d9 100644 --- a/tools/template.js +++ b/tools/template.js @@ -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}`; };