test_run_rustdoc_against_real_crate¶
Tests › tests/test_rustdoc.py
What this test is for
Why it exists
The end-to-end contract: a real `cargo +nightly rustdoc` run against a real crate lands a doxygen-shaped database with the right path/memberdef rows — the same shape `tests/richdb.py` hand-makes for the C fixture.
Given
db_path = tmp_path / "rustdoc.db"
When
result = run_rustdoc(RUSTSAMPLE, db_path)conn = sqlite3.connect(str(db_path))try: names = {row[0] for row in conn.execute("SELECT name FROM memberdef")} assert {"add", "helper", "MAX_RETRIES"} <= names brief = conn.execute( "SELECT briefdescription FROM memberdef WHERE name = 'add'" ).fetchone()[0] assert brief == "Adds two numbers together." add_static, helper_static = ( conn.execute("SELECT static FROM memberdef WHERE name = ?", (name,)).fetchone()[0] for name in ("add", "helper") ) assert add_static == 0 # pub fn assert helper_static == 1 # private fn path_row = conn.execute( "SELECT p.name FROM memberdef m JOIN path p ON p.rowid = m.file_id WHERE m.name = 'add'" ).fetchone() assert path_row[0] == "src/main.rs" # Every downstream stage that guards with _table_exists (dispatch_edges.py) # still gets a real, empty compounddef table rather than a missing one. assert conn.execute("SELECT COUNT(*) FROM compounddef").fetchone()[0] == 0 finally: conn.close()
Then
- ✓ result equals db_path
tests/test_rustdoc.py:233 · its file's page
What it checks (7)
assert result == db_pathobservesrun_rustdocviaresultassert {"add", "helper", "MAX_RETRIES"} <= namesnot attributedassert brief == "Adds two numbers together."not attributedassert add_static == 0not attributedassert helper_static == 1not attributedassert path_row[0] == "src/main.rs"not attributedassert conn.execute("SELECT COUNT(*) FROM compounddef").fetchone()[0] == 0not 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_run_rustdoc_against_real_crate→run_rustdocWhat 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