Registry for tracking which functions are covered by which tests.
This namespace provides the foundation for transitive test coverage proofs. Tests declare which functions they cover via the :covers metadata in the specification macro, and this registry tracks those declarations.
The :covers metadata is a map of {fn-symbol signature-string} where the signature is a short hash of the function's source code at the time the test was written/verified. This enables staleness detection when functions change.
Registry for tracking which functions are covered by which tests.
This namespace provides the foundation for transitive test coverage proofs.
Tests declare which functions they cover via the :covers metadata in the
specification macro, and this registry tracks those declarations.
The :covers metadata is a map of {fn-symbol signature-string} where the
signature is a short hash of the function's source code at the time the
test was written/verified. This enables staleness detection when functions
change.(all-covered-functions)Returns a vector of all function symbols that have declared test coverage.
Returns a vector of all function symbols that have declared test coverage.
(all-sealed-functions)Returns a vector of all function symbols that have sealed signatures.
Returns a vector of all function symbols that have sealed signatures.
(clear-registry!)Clear the coverage registry. Useful for testing.
Clear the coverage registry. Useful for testing.
(coverage-summary)Returns a summary map of coverage information.
Returns:
Returns a summary map of coverage information. Returns: - :total-functions - count of functions with any coverage - :sealed-functions - count of functions with sealed signatures - :coverage-map - the full registry (for debugging)
(covered-by fn-sym)Returns set of test symbols that cover the given function.
Returns nil if the function is not in the coverage registry. Returns a (possibly empty) set if the function has been registered.
Use covered? for a boolean check of whether the function has coverage.
Returns set of test symbols that cover the given function. Returns nil if the function is not in the coverage registry. Returns a (possibly empty) set if the function has been registered. Use `covered?` for a boolean check of whether the function has coverage.
(covered? fn-sym)Returns true if fn-sym has at least one test covering it.
Returns true if fn-sym has at least one test covering it.
(functions-covered-by test-sym)Returns a vector of function symbols that the given test covers.
This is the inverse of covered-by - it answers 'what does this test cover?'
rather than 'what tests cover this function?'.
Useful for test filtering to determine what functions a test is responsible for.
Returns a vector of function symbols that the given test covers. This is the inverse of `covered-by` - it answers 'what does this test cover?' rather than 'what tests cover this function?'. Useful for test filtering to determine what functions a test is responsible for.
(register-coverage! test-sym fn-sym)(register-coverage! test-sym fn-sym signature)Register that test-sym covers fn-sym with optional signature.
Both test-sym and fn-sym should be fully qualified symbols. The signature is a short hash of the function's source at seal time.
If signature is nil, only the test association is recorded (legacy mode). If a different signature is registered for the same function, the new signature overwrites the old one (most recent wins).
Register that `test-sym` covers `fn-sym` with optional signature. Both test-sym and fn-sym should be fully qualified symbols. The signature is a short hash of the function's source at seal time. If signature is nil, only the test association is recorded (legacy mode). If a different signature is registered for the same function, the new signature overwrites the old one (most recent wins).
(sealed-signature fn-sym)Returns the sealed signature for a function, or nil if not sealed.
The sealed signature is the hash of the function's source code at the time the covering test was written/verified.
Returns the sealed signature for a function, or nil if not sealed. The sealed signature is the hash of the function's source code at the time the covering test was written/verified.
(sealed? fn-sym)Returns true if fn-sym has a sealed signature recorded.
Returns true if fn-sym has a sealed signature recorded.
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 |