[ADD]Test : unit test case macro

This commit is contained in:
Fabien BOURGEOIS 2021-02-18 20:49:40 +01:00
parent d1071b8e61
commit ce816fc284
1 changed files with 7 additions and 0 deletions

View File

@ -27,3 +27,10 @@
(defmacro odo-assert-raises [Error body]
"Macro to test Error with self.assertRaises and do block"
`(with [err (.assertRaises self ~Error)] ~body))
(defmacro o-test [name body]
"Macro for unit test case"
(setv fn-name (% "test-%s" (str name))
humanized-name (.replace (str name) "-" " ")
descr (bytes (% "Test %s" humanized-name)))
`(defn ~(HySymbol fn-name) [self] ~descr ~body))