test_nested_functions_are_definitions_under_their_enclosing_function¶
Tests › tests/test_ts_nested.py
What this test is for
Why it exists
Named closures are definitions under their enclosing function; hook values are not.
Given
out = harvest_definitions(lps.parse_tree("typescript", _SRC), _SRC)got = {(f["cls"], f["name"]) for f in out["functions"]}
When
- —
Then
- ✓ { ("", "outer"), ("outer", "inner"), ("outer", "helper"), ("outer", "onPress"), ("Svc", "run"), ("Svc.run", "step"), } is at most got
- ✓ got does not contain ("outer", "value")
What it exercises
The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.
`main` (clew/guard/main.py) · 7 of 357 steps
… 127 earlier steps
… 2 steps between
… 203 later steps
tests/test_ts_nested.py:60 · its file's page
What it checks (2)
assert { ("", "outer"), ("outer", "inner"), ("outer", "helper"), ("outer", "onPress"), ("Svc", "run"), ("Svc.run", "step"), } <= got, gotnot attributedassert ("outer", "value") not in got, "useMemo binds a value, not its callback"not attributed
What 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 4 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-GUARD-019 measured
- REQ-DDB-GUARD-020 measured
- REQ-DDB-GUARD-025 measured
- REQ-DDB-PIPE-012 measured