Skip to main content

Module catalog

Module catalog 

Source
Expand description

The catalog module gives read access to the assertion catalog compiled into this binary: every assertion macro call site linked into the program, whether or not that code ever runs.

It exists for tooling rather than for workloads: comparing the assertions a binary declares against the ones a local test suite encounters, failing CI when a change silently drops an assertion, or checking an inventory of test properties into the repository. Workloads use assert and random instead and never need this module.

catalog::assertions() lists the assertions as values. catalog::write() writes them as the same JSON lines, in the same order, that antithesis_init() emits for them, without init having run. A binary can expose its own catalog with a few lines:

use std::io::stdout;

fn main() -> std::io::Result<()> {
    if std::env::args().any(|a| a == "--antithesis-catalog") {
        return antithesis_sdk::catalog::write(stdout());
    }
    // ... the actual program ...
    Ok(())
}

Structs§

Assertion
One assertion declaration compiled into this binary.
SourceLocation
Where an assertion was declared, as captured by the macro at compile time.

Enums§

AssertionKind
Which assertion macro a declaration came from.

Functions§

assertions
Every assertion declaration compiled into this binary.
write
Writes the assertions of assertions() to out as JSON lines.