36 lines
887 B
Fennel
36 lines
887 B
Fennel
"This document does not include tests. Instead it includes macros that are used for tests."
|
|
|
|
(fn it [desc ...]
|
|
"busted's `it` function"
|
|
`((. (require :busted) :it)
|
|
,desc (fn [] ,desc ,...)))
|
|
|
|
(fn describe [desc ...]
|
|
"busted's `describe` function"
|
|
`((. (require :busted) :describe)
|
|
,desc (fn [] ,desc ,...)))
|
|
|
|
(fn before-each [...]
|
|
"busted's `describe` function"
|
|
`((. (require :busted) :before_each)
|
|
(fn [] ,...)))
|
|
|
|
|
|
(fn is-matching [item pattern ?msg]
|
|
"check if item matches a pattern according to fennel's `match` builtin"
|
|
`(match ,item
|
|
,pattern nil
|
|
?otherwise#
|
|
(error
|
|
(.. "Pattern did not match:\n"
|
|
(let [fennel# (require :fennel)]
|
|
(fennel#.view ?otherwise#))
|
|
"\ndid not match pattern:\n"
|
|
,(view pattern)
|
|
(and ,?msg (.. "\n" ,?msg))))))
|
|
|
|
{: it
|
|
: describe
|
|
: is-matching
|
|
: before-each}
|