5. Tests
A test step checks the things a cook step produced. It declares no outputs; its exit code is the verdict. A test inherits the preceding cook step's outputs as…
A test step checks the things a cook step produced. It declares no outputs;
its exit code is the verdict. A test inherits the preceding cook step’s
outputs as its inputs (or the recipe’s gather if no cook ran):
recipe check gather "src/*.c" cook "build/$<in.stem>" { gcc $<in> -o $<out> } test { ./$<in> --selftest }A failure in one test unit doesn’t cancel the others: cook collects every
failure and reports them together. There are no test modifiers; to write a check
that’s expected to fail, invert the command with !:
recipe lint gather "src/*.c" test { ! grep -q TODO $<in> }cook test runs every test in the workspace and aggregates a pass/fail summary.
Because test results are content-keyed to the outputs they consume, unchanged
code doesn’t re-run its tests.
cook test # everythingcook test apps.web # scope to a namespacecook test --fail-fast # stop on first failurecook test --rerun-failed # re-run only what failed last timecook test --report-junit results.xml