report bodyless tests as PENDING

This commit is contained in:
Daniel Barlow 2024-04-21 11:19:42 +01:00
parent e9370358ae
commit 648382f64a

View file

@ -6,10 +6,12 @@
(fn fail [d msg] (set failed true) (print :FAIL d (.. "\n" msg))) (fn fail [d msg] (set failed true) (print :FAIL d (.. "\n" msg)))
(macro example [description & body] (macro example [description & body]
`(let [(ok?# err#) (xpcall (fn [] ,body) debug.traceback)] (if (. body 1)
(if ok?# `(let [(ok?# err#) (xpcall (fn [] ,body) debug.traceback)]
(print :PASS ,description) (if ok?#
(fail ,description err#)))) (print :PASS ,description)
(fail ,description err#)))
`(print :PENDING ,description)))
(example (example
"given an empty database, searching it finds no entries" "given an empty database, searching it finds no entries"