No results
1
Home
dxtr edited this page 2026-10-18 12:07:40 +02:00
Table of Contents
assay
assay is a zero-dependency test framework for SBCL, with the ergonomics of
Go's testing, Rust's harness, Tasty and JUnit/AssertJ, plus a Mockito-style
mocking layer. It replaces Parachute.
It is two source files in one ASDF system. You can vendor assay.lisp alone
into a project and get everything except mocks.
(defpackage #:parser/test (:use #:cl #:assay #:parser))
(in-package #:parser/test)
(deftest parse-numbers
"Decimal integers, with and without sign."
(is (= 42 (parse "42")))
(is (= -1 (parse "-1")))
(signals parse-error (parse "4x2")))
CL-USER> (assay:run :parser/test)
parser/test ✓ 1 passed (0.3 ms)
ok: 1 test (0.3 ms)
#<SUMMARY 1 tests, all passed>
One macro, is, does the work AssertJ needs a fluent API for: it reads its own
source form, evaluates each operand once, and on failure shows every
non-literal operand with its value plus a one-line explanation.
CL-USER> (is (= -1 (parse "-1"))) ; parse returns 1 here
✗ (is (= -1 (parse "-1")))
(parse "-1") ⇒ 1
differ by 2
Why assay
- No dependencies. SBCL and its bundled contribs, nothing else. A test framework belongs at the bottom of the dependency graph.
- One assertion.
issees your source, so(is (= a b))showsa,band how they differ — noassert-equal, no fluent chains. - Explanations you can extend.
explainis a generic function; teach it your own predicates and every failure gets a helpful line. - Record and continue. Like Go's
t.Errorand JUnit'sassertAll; onlymuststops the test. - Parallel when you ask. One worker per core, opt out per test with
:serial t; the report is identical to a serial run's. - Mocks that read like tests.
with-mocksswaps global functions for a dynamic extent; verification isiswithcalled-p,call-countandcalls.
Installing
assay is plain ASDF. Put the checkout where ASDF can find it:
(asdf:load-system "assay")
Requires SBCL 2.4 or later. There is no portability layer; assay uses SBCL's threads, timeouts, backtraces and alien calls directly.
The manual
- Defining Tests —
deftest, its options, the registry - Assertions —
is,must,signals,finishesand friends - Explain — the one-line failure explanations, and how to add your own
- Structure —
subtestand the table-drivencases - Running —
run, selecting tests, the summary, the debugger - Command Line —
main, the flags, and ASDF'stest-op - Parallel — parallel runs and the
:serialrule - Mocks —
with-mocksand verification - Output Format — what the reporter prints, exactly
- Events and Reporters — the condition protocol and custom reporters
- Migrating from Parachute — a one-screen cheat sheet
License
MIT. Copyright © 2026 dxtr.