summaryrefslogtreecommitdiff
path: root/test.fnl
diff options
context:
space:
mode:
Diffstat (limited to 'test.fnl')
-rw-r--r--test.fnl14
1 files changed, 10 insertions, 4 deletions
diff --git a/test.fnl b/test.fnl
index da25c26..0e797bd 100644
--- a/test.fnl
+++ b/test.fnl
@@ -29,12 +29,17 @@
([expr msg]
`(assert ,expr (.. "assertion failed for " (or ,msg ,(tostring expr))))))
-(fn* test
+(fn* deftest [name docstring & tests]
+ "Simple way of grouping tests"
+ `(do
+ ,docstring
+ ,((or table.unpack _G.unpack) tests)))
+
+(fn* testing
"Define test function, print its name and run it."
- [name docstring & body]
+ [name & body]
(let [test-name (sym (.. (tostring name) "-test"))]
`(do (fn ,test-name []
- ,(or docstring nil)
,((or table.unpack _G.unpack) body))
(io.stderr:write (.. "running: " ,(tostring test-name) "\n"))
(,test-name))))
@@ -42,4 +47,5 @@
{: assert-eq
: assert-ne
: assert*
- : test}
+ : deftest
+ : testing}