nl-unittest
is a simple unit testing framework for newLISP [1], a
modern dialect of Lisp [2].
Just load the file: nl-unittest.lsp
in the main directory.
UnitTest:*verbose*
true
if you want to output the whole assert expression, andnil
if you want the output to be of the form=> Expected: <some-value> -> Received: <some-value>
. Default value:nil
.UnitTest:*continue-after-failure*
true
if you want to continue testing whatever the previous test case result is, andnil
otherwise. Default value:true
.UnitTest:*enable-term-color*
true
if you want to have colors in VT-100 compatible terminal, andnil
otherwise. Default value:true
.UnitTest:*report-failed*
true
if you want to report failed assertions, andnil
otherwise. Default value:true
.UnitTest:*report-passed*
true
if you want to report passed assertions, andnil
otherwise. Default value:nil
.
- First, load the main file
nl-unittest.lsp
. You will have a defined context namedUnitTest
. - Define a test case with:
(define-test (test-name params) body*)
. Remember to have convention fortest-name
or you might suffer from symbols conflicting. - Whenever you want to run a test case, call its in exactly the same way you call function.
- If you want to run all the test cases at the same time, name the test with the prefix
test_
and call(UnitTest:run-all context-symbol)
.
- Fix time calculation.
- More options about output.
- Separating output and results.
- Assertions inside other forms (Done! Sun, 05 Jun 2011 00:34:31 +0700)
See COPYING for more details.
[1] | http://www.newlisp.org |
[2] | http://en.wikipedia.org/wiki/Lisp_(programming_language) |