Add test description to error message

This commit is contained in:
Geoffrey Booth 2016-11-29 18:27:34 -08:00
parent 06b3180223
commit 8c8ebf874a
1 changed files with 10 additions and 4 deletions

View File

@ -33,6 +33,7 @@
<script type="text/coffeescript">
stdout = document.getElementById 'stdout'
desc = ''
start = new Date
success = total = done = failed = 0
@ -44,12 +45,17 @@ say = (msg, emphasis) ->
stdout.appendChild div
msg
@test = (desc, fn) ->
@test = (description, fn) ->
desc = description
fn()
@ok = (good, msg) ->
++total
if good then ++success else throw Error say msg, no
if good
++success
else
say "#{desc}:", no
throw Error say msg, no
@eq = (x, y, msg) -> ok x is y, msg ? x + ' isnt ' + y
@ -88,8 +94,8 @@ for test in document.getElementsByClassName 'test'
say '\u2714 ' + test.id
try
CoffeeScript.run test.innerHTML
catch exception
console.error exception
catch error
console.error error
# Finish up
yay = success is total and not failed