test_definitions_functions_and_classes¶
Tests › tests/test_jsts.py
What this test is for
Why it exists
The test says nothing about why.
Given
out = harvest_definitions(_tree("typescript", TS), TS)functions = {(f["cls"], f["name"]): f for f in out["functions"] if not f.get("decl")}classes = {c["name"]: c for c in out["classes"]}
When
- —
Then
- ✓ {(f["cls"], f["name"]) for f in out["functions"] if f.get("decl")} equals {("Shape", "area")}
- ✓ set(functions) equals { ("Formatter", "trim"), ("Formatter", "clean"), ("Formatter", "make"), ("", "normalize"), ("", "run"), }
- ✓ functions[("Formatter", "make")]["static"] equals 1
- ✓ functions[("", "normalize")]["ret"] equals "string"
- ✓ functions[("", "run")]["line"] equals 23
- ✓ functions[("", "run")]["end"] equals 26
- ✓ classes["Formatter"]["bases"] equals ["Base", "Shape"]
- ✓ classes["Shape"]["kind"] equals "interface"
- ✓ classes["Formatter"]["doc"] contains "Formats strings."
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) · 19 of 357 steps
… 127 earlier steps
… 8 steps between
… 181 later steps
tests/test_jsts.py:67 · its file's page
What it checks (8)
assert {(f["cls"], f["name"]) for f in out["functions"] if f.get("decl")} == {("Shape", "area")}observes_treeviaoutassert set(functions) == { ("Formatter", "trim"), ("Formatter", "clean"), ("Formatter", "make"), ("", "normalize"), ("", "run"), }, "anonymous callbacks are not definitions"not attributedassert functions[("Formatter", "make")]["static"] == 1not attributedassert functions[("", "normalize")]["ret"] == "string"not attributedassert functions[("", "run")]["line"] == 23 and functions[("", "run")]["end"] == 26not attributedassert classes["Formatter"]["bases"] == ["Base", "Shape"]not attributedassert classes["Shape"]["kind"] == "interface"not attributedassert "Formats strings." in classes["Formatter"]["doc"]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_definitions_functions_and_classes→_treeWhat 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 5 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-GUARD-019 measured
- REQ-DDB-GUARD-020 measured
- REQ-DDB-GUARD-024 measured
- REQ-DDB-GUARD-025 measured
- REQ-DDB-PIPE-012 measured