mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Add test description to error message
This commit is contained in:
parent
06b3180223
commit
8c8ebf874a
1 changed files with 10 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue