forked from DGNum/liminix
improve failed test reporting
This commit is contained in:
parent
712c9b266f
commit
e34135c41a
1 changed files with 8 additions and 3 deletions
|
@ -31,8 +31,14 @@
|
||||||
(tset db e.path e)))
|
(tset db e.path e)))
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
(var failed false)
|
||||||
|
(fn fail [d msg] (set failed true) (print :FAIL d (.. "\n" msg)))
|
||||||
|
|
||||||
(macro example [description & body]
|
(macro example [description & body]
|
||||||
`(do ,body))
|
`(let [(ok?# err#) (xpcall (fn [] ,body) debug.traceback)]
|
||||||
|
(if ok?#
|
||||||
|
(print :PASS ,description)
|
||||||
|
(fail ,description err#))))
|
||||||
|
|
||||||
(example
|
(example
|
||||||
"given an empty database, searching it finds no entries"
|
"given an empty database, searching it finds no entries"
|
||||||
|
@ -74,5 +80,4 @@ SEQNUM=1527")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(if failed (os.exit 1) (print "OK"))
|
||||||
(print "OK")
|
|
||||||
|
|
Loading…
Reference in a new issue