test_callback_edges_resolves_struct_literal_registration¶
Tests › tests/test_rust_ast.py
What this test is for
Why it exists
The test says nothing about why.
Given
tree, src = _parse( "fn handler(x: i32) -> i32 { x }\n" "struct Widget { callback: fn(i32) -> i32 }\n" "impl Widget {\n" " fn new(h: fn(i32) -> i32) -> Self {\n" " Self { callback: h }\n" " }\n" " fn fire(&self, x: i32) -> i32 {\n" " (self.callback)(x)\n" " }\n" "}\n" "fn build() -> Widget {\n" " Widget::new(handler)\n" "}\n" )
When
out = _harvest_callback_file(tree, src)reg_globals = {r[1] for r in out["regs"]}call_names = {c[1] for c in out["calls"]}
Then
- ✓ reg_globals contains "Widget::callback"
- ✓ call_names contains "new"
- ✓ call_names contains "Widget::callback"
tests/test_rust_ast.py:201 · its file's page
What it checks (3)
assert "Widget::callback" in reg_globalsnot attributedassert "new" in call_namesnot attributedassert "Widget::callback" in call_namesnot 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_callback_edges_resolves_struct_literal_registration→_parse→_harvest_callback_fileWhat 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-003 measured