summaryrefslogtreecommitdiff
path: root/test.fnl
diff options
context:
space:
mode:
authorAndrey Orst <andreyorst@gmail.com>2020-10-26 21:46:54 +0300
committerAndrey Orst <andreyorst@gmail.com>2020-10-26 21:46:54 +0300
commit3ef9b8f888bf2dda7ce690a84a60bbade0223933 (patch)
tree6cccb5b4d469f62128205352222789768eee513a /test.fnl
parent1d2bba82b09710b0dc6ca4e1a515763088b3fbf5 (diff)
feature(testing): group tests, update coverage script
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}