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))
where
#1# = 6
Note the #N# syntax due to *PRINT-CIRCLE*.This is how to define an run tests:
(deftest should-work ()
(is t))
;;; non-interactive
(try 'should-work)
.. SHOULD-WORK ; TRIAL-START
.. ⋅ (IS T) ; EXPECTED-RESULT-SUCCESS
.. ⋅ SHOULD-WORK ⋅1 ; EXPECTED-VERDICT-SUCCESS
..
==> #<TRIAL (SHOULD-WORK) EXPECTED-SUCCESS 0.000s ⋅1>
;;; interactive equivalent
(should-work)
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
Repository: https://github.com/melisgl/try
Author: Gabor Melis
Test Framework, MIT-LICENSE