test(mutants): a surviving mutant is not exit zero (H4, red)

The harness returned `2 if errors else 0`, so a run printing `killed 0
of 1` and naming its survivor exited 0. PM measured it on a copy
carrying only the X2 mutant. Red on the claim: the module imports, and
offers no verdict to ask.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-19 05:49:37 +02:00
commit 6abe4b4358
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q

View file

@ -887,6 +887,19 @@ def test_a_unit_clean_in_only_one_of_the_two_builds_is_not_clean() -> None:
assert gate.clean_in_every_run([[clean], [dirty]]) == 0
def test_a_surviving_mutant_is_not_exit_zero() -> None:
"""H4: the mutation harness returned `2 if errors else 0`, so a run that
printed `killed 0 of 1` and named the survivor exited 0. PM measured it on
a copy carrying only the X2 mutant. A harness nothing can fail is a report,
not a gate."""
import okf_gate_mutants as mutants
assert mutants.verdict(survived=[], errors=[]) == 0
assert mutants.verdict(survived=["X2"], errors=[]) == 1
assert mutants.verdict(survived=[], errors=["not applied"]) == 2
assert mutants.verdict(survived=["X2"], errors=["not applied"]) == 2
def test_the_gate_exits_one_when_a_row_is_red(monkeypatch: pytest.MonkeyPatch) -> None:
"""M14: nothing checked the real command's exit code, so `main` could
return 0 over a red table and no test would notice."""