Replace assert with Test.assert.
This commit is contained in:
parent
51a6893fdd
commit
375c717dea
@ -18,6 +18,10 @@ Test =
|
|||||||
Header.menu.addEntry
|
Header.menu.addEntry
|
||||||
el: a2
|
el: a2
|
||||||
|
|
||||||
|
assert: (condition) ->
|
||||||
|
unless condition()
|
||||||
|
new Notice 'warning', "Assertion failed: #{condition}", 30
|
||||||
|
|
||||||
normalize: (root) ->
|
normalize: (root) ->
|
||||||
root2 = root.cloneNode true
|
root2 = root.cloneNode true
|
||||||
for el in $$ '.mobile', root2
|
for el in $$ '.mobile', root2
|
||||||
|
|||||||
@ -71,7 +71,10 @@ Linkify =
|
|||||||
|
|
||||||
if Linkify.regString.test word
|
if Linkify.regString.test word
|
||||||
links.push Linkify.makeRange node, endNode, index, length
|
links.push Linkify.makeRange node, endNode, index, length
|
||||||
<% if (readJSON('/.tests_enabled')) { %><%= assert('word is links[links.length-1].toString()') %><% } %>
|
<% if (readJSON('/.tests_enabled')) { %>
|
||||||
|
Test.assert ->
|
||||||
|
word is links[links.length-1].toString()
|
||||||
|
<% } %>
|
||||||
|
|
||||||
break unless test.lastIndex and node is endNode
|
break unless test.lastIndex and node is endNode
|
||||||
|
|
||||||
|
|||||||
@ -171,10 +171,6 @@ tools.html = function(template) {
|
|||||||
return `\`{innerHTML: ${output}}\``;
|
return `\`{innerHTML: ${output}}\``;
|
||||||
};
|
};
|
||||||
|
|
||||||
tools.assert = function(statement) {
|
|
||||||
return `throw new Error 'Assertion failed: ' + \`${constExpression(statement)}\` unless ${statement}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
function includesDir(templateName) {
|
function includesDir(templateName) {
|
||||||
var dir = path.dirname(templateName);
|
var dir = path.dirname(templateName);
|
||||||
var subdir = path.basename(templateName).replace(/\.[^.]+$/, '');
|
var subdir = path.basename(templateName).replace(/\.[^.]+$/, '');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user