feat(8247): a test case is accounted for by what it guards, and the coverage line counts the suite by it
CI & Build / TypeScript typecheck (push) Successful in 37s
CI & Build / Plugin hooks (push) Successful in 17s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Python tests (push) Successful in 2m24s
CI & Build / integration (push) Successful in 2m22s
CI & Build / Build & push image (push) Successful in 43s
CI & Build / TypeScript typecheck (push) Successful in 37s
CI & Build / Plugin hooks (push) Successful in 17s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Python tests (push) Successful in 2m24s
CI & Build / integration (push) Successful in 2m22s
CI & Build / Build & push image (push) Successful in 43s
A refresh now stamps a test case `test` when it is linked to something it guards, and withdraws the stamp when its links go; a judgment always wins. A test case linked to nothing stays in the todo, because nothing says what it is for. Specs written as it()/test() calls get one ledger row per file, read whole. The coverage line and card count tests linked, guarding nothing found, and redundant, and the end-of-turn question no longer asks the writer to call a test case a one-off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -169,3 +169,31 @@ def test_the_coverage_line_names_the_removal_verdicts_and_the_test_groups():
|
||||
})
|
||||
assert "2 redundant" in line and "1 unused" in line
|
||||
assert "3 test groups guarding the same thing" in line
|
||||
|
||||
|
||||
def test_a_test_case_is_a_test_named_definition_or_a_call_style_spec_file():
|
||||
assert tg.is_test_case("tests/test_a.py", "test_x", "sym")
|
||||
assert not tg.is_test_case("tests/test_a.py", "_helper", "sym")
|
||||
assert not tg.is_test_case("src/app/billing.py", "test_mode", "sym")
|
||||
assert tg.is_test_case("web/src/a.spec.ts", "a.spec", "file")
|
||||
|
||||
|
||||
def test_a_spec_written_as_calls_is_one_test_and_links_by_its_imports():
|
||||
text = "import { charge } from '../app/billing'\n\nit('charges', () => {\n expect(charge(1)).toBe(1)\n})\n"
|
||||
assert tg.is_call_style_spec("web/src/billing.spec.ts", text, [])
|
||||
# A file that defines test-named functions is read per function instead.
|
||||
assert not tg.is_call_style_spec("tests/test_a.py", "def test_x():\n pass\n", ["test_x"])
|
||||
spec = tg.Def("web/src/billing.spec.ts", "billing.spec", text)
|
||||
product = tg.Def("web/app/billing.ts", "charge", "export function charge(n) {\n return n\n}\n")
|
||||
links = tg.link_tests([product], {spec.path: tg.read_test_file(text)}, file_tests=[spec])
|
||||
assert links.shapes[(spec.path, "billing.spec")] == {("web/app/billing.ts", "charge")}
|
||||
|
||||
|
||||
def test_the_coverage_line_counts_tests_by_what_they_guard():
|
||||
line = coverage_line({
|
||||
"accounted": 10, "total": 12, "unclassified": 2, "counts": {"test": 8},
|
||||
"tests": {"linked": 8, "unlinked": 2, "redundant": 1},
|
||||
"computed_at": "2026-12-01T00:00:00+00:00",
|
||||
})
|
||||
assert "8 test" in line
|
||||
assert "tests: 8 linked · 2 guarding nothing found · 1 redundant" in line
|
||||
|
||||
Reference in New Issue
Block a user