Skip to main content

Module gentests

Module gentests 

Source
Expand description

Generated artifacts from markdown code blocks: one integration-test target per package with a module per page (plain rust blocks), and one example per package with a module per capture block. CI compares regenerated content against disk, so stale artifacts fail.

Structs§

Generated
One generated file, its path relative to the package directory.
PageCounts
What one page’s rust blocks and markers add up to.

Constants§

CAPTURE_DIR
The one example target every capture block of a package compiles into.
CAPTURE_DISABLED
Exit status of the capture example for a block whose feature= tag is not enabled in this build. The stderr line starts with the sentinel.
CAPTURE_EXAMPLE
Cargo’s name for the CAPTURE_DIR example.
CAPTURE_UNKNOWN
Exit status of the capture example for a block id it does not contain.
DOC_TESTS_DIR
The one integration-test target the doc tests of a package compile into.
GENERATED_HEADER
First line of every generated file; docs check uses it to tell generated artifacts from hand-written ones.
OWNED
Where generated files live, as (directory, file-name prefix, replaced by), relative to the package directory. A file there that starts with GENERATED_HEADER belongs to gen-tests: it is rewritten when expected and removed when not. An entry with an empty prefix is a target directory gen-tests owns outright; a prefixed entry is the per-page or per-block layout of earlier releases and names the target directory that replaced it.

Functions§

capture_ids
Block ids for one page’s capture blocks, in capture order: the argument the capture example takes to run that block.
capture_set
Every capture file a package needs: one block_<id>.rs module per capture block under CAPTURE_DIR, and the main.rs that runs the block its first argument names. Empty when no page has a capture block.
doc_test_set
Every doc-test file a package needs: one module per page with testable blocks under DOC_TESTS_DIR, and the main.rs that declares them. Empty when no page has a testable block. An error names two pages whose paths sanitize to the same module.
owning_target
For rel_path (relative to the package directory) in a place gen-tests writes, per OWNED: the target directory it belongs to, and whether it is a leftover of the layout that target replaced. The file’s header decides ownership.
page_counts
Count doc’s rust blocks by whether they execute, and its markers. Capture blocks run in the capture example, not as doc tests, so they are in neither count.
recorded_source
The page a generated file was generated from, and the line of the block when it is one block’s file, read from its // source: PAGE[ line N] line.
sanitized_stem
docs/measuring.md → soothfast_doc_docs_measuring.
test_file
Module content for one markdown page’s doc tests, or None when it has no testable blocks (all ignored / non-rust / capture).