From ce816fc284ef43deec47a9ccd9f3cdf9daa16881 Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Thu, 18 Feb 2021 20:49:40 +0100 Subject: [PATCH] [ADD]Test : unit test case macro --- hy_odoo/test.hy | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hy_odoo/test.hy b/hy_odoo/test.hy index a1b6ec2..eb020e3 100644 --- a/hy_odoo/test.hy +++ b/hy_odoo/test.hy @@ -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))