Try is a library for unit testing with equal support for interactive and non-interactive workflows. Tests are functions, and almost everything else is a condition, whose types feature prominently in parameterization. Try is what we get if we make tests functions and build a test framework on top of the condition system like Stefil
did but also address the issue of rerunning and replaying, make the IS check more capable, use the types of the condition hierarchy to parameterize what to debug, print, rerun, and document the whole thing.
The IS macro is a replacement for assert, that can capture values of subforms to provide context to failures:
(is (= (1+ 5) 0))
debugger invoked on a TRY:UNEXPECTED-RESULT-FAILURE:
UNEXPECTED-FAILURE in check:
(IS (= #1=(1+ 5) 0))
#1# = 6
Note the #N# syntax due to *PRINT-CIRCLE*
This is how to define an run tests:
(deftest should-work ()
.. SHOULD-WORK .. ⋅ (IS T) .. ⋅ SHOULD-WORK ⋅1 ..
==> #<TRIAL (SHOULD-WORK) EXPECTED-SUCCESS 0.000s ⋅1>
Test suites are simply test functions that call other test functions.
TRIAL objects record results and are funcallable. Calling
TRY or funcalling the trial reruns tests with unexpected results:
Try is not small, but it has a regular design and very few core concepts.
HTML documentation: https://melisgl.github.io/mgl-pax-world/try-manual.html
Author: Gabor Melis