Date: 2026-07-02
Zig has a built-in test runner (zig test) that compiles and runs
test blocks. clj-zig users write both Clojure tests (for the
Clojure-side behavior) and Zig tests (for the native-side logic), but
the Zig tests had no bridge to the Clojure test runner.
clj-zig.zigtest/deftestz is a macro that defines a Clojure test
(deftest) wrapping a zig test invocation. The Zig body is written
to a temp file and compiled with zig test; the exit code determines
pass or fail. On failure, the compiler output is included in the
assertion message.
A deftestz test integrates with clojure.test runners and CI. The
Zig test body is a standalone source file (no clj-zig wrappers); it
tests pure Zig logic, not the FFM boundary. The boundary is tested by
the existing Clojure-side integration tests.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |