PSC Code Manual

util/test.lsp [src]

Functions related to unit testing

Functions

Function signature Description
(defun-t test-sym) Registers function at TEST-SYM as a unit test.
(test-build) Bootstraps test build process and opens a new blank drawing to carry it out.
(test-build-lsp) Writes tests.lsp with all the test forms in *file-tests*
(test-run) Alias for (load "tests.lsp").

(defun-t test-sym)

Registers function at TEST-SYM as a unit test.

Test functions should:

- take no arguments
- have short (1-line) docstrings describing what they test
- return a list of assertion errors using assert-all
- be self contained
- NOT set any symbols in the global environment

Each test function will be wrapped with advice that reports failures by printing its name,
docstring, and errors (otherwise it returns nil). A call to the resulting function will be
saved to *file-tests* so test-build-lsp can write them to tests.lsp. Then, TEST-SYM will
be set to nil to mark the original test function for garbage collection.

(test-build)

Bootstraps test build process and opens a new blank drawing to carry it out.

(test-build-lsp)

Writes tests.lsp with all the test forms in *file-tests*

(test-run)

Alias for (load "tests.lsp").