diff options
| author | Andrey Orst <andreyorst@gmail.com> | 2020-10-26 21:46:54 +0300 |
|---|---|---|
| committer | Andrey Orst <andreyorst@gmail.com> | 2020-10-26 21:46:54 +0300 |
| commit | 3ef9b8f888bf2dda7ce690a84a60bbade0223933 (patch) | |
| tree | 6cccb5b4d469f62128205352222789768eee513a /test.fnl | |
| parent | 1d2bba82b09710b0dc6ca4e1a515763088b3fbf5 (diff) | |
feature(testing): group tests, update coverage script
Diffstat (limited to 'test.fnl')
| -rw-r--r-- | test.fnl | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -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} |