test_discover_targets_documents_both_lib_and_same_named_bin¶
Tests › tests/test_rustdoc.py
What this test is for
Why it exists
RUSTDOC_INTEGRATION_FEEDBACK.md, finding 1: `knots` and `tools_sqc` both pair a `[lib]` with a same-named `[[bin]]`, and the old lib-instead-of-bin selection silently dropped every module reachable only from the bin (`main.rs`, CLI parsing, config loading, output formatting) with no error — `cargo metadata` succeeds either way, so nothing in the build log said a target was skipped. This crate reproduces that exact shape and asserts both targets come back.
Given
if shutil.which("cargo") is None: pytest.skip("needs cargo")(tmp_path / "Cargo.toml").write_text( '[package]\nname = "dual"\nversion = "0.1.0"\nedition = "2021"\n\n' '[lib]\nname = "dual"\n\n[[bin]]\nname = "dual"\npath = "src/main.rs"\n', encoding="utf-8", )
4 more
src = tmp_path / "src"src.mkdir()(src / "lib.rs").write_text("pub fn helper() {}\n", encoding="utf-8")(src / "main.rs").write_text("fn main() {}\n", encoding="utf-8")
When
targets = _discover_targets(tmp_path)kinds = {(t.name, t.kind) for t in targets}
Then
- ✓ kinds equals {("dual", "lib"), ("dual", "bin")}
tests/test_rustdoc.py:193 · its file's page
What it checks (1)
assert kinds == {("dual", "lib"), ("dual", "bin")}, ( f"a package with both a lib and a same-named bin must document both; got {kinds}" )not attributed
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
test_discover_targets_documents_both_lib_and_same_named_bin→_discover_targetsWhat it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Also reaches 1 requirement
Its run touches their code; that is reach, not proof.
- REQ-DDB-PIPE-006 measured