Kill the mutants that survived in the Rust planter
CI / tests (pull_request) Successful in 4m13s

This commit is contained in:
2026-11-24 02:34:10 +01:00
parent a1465a386a
commit 70fbc2a02d
2 changed files with 6 additions and 2 deletions
+3 -2
View File
@@ -56,7 +56,8 @@ def changed(diff: bytes) -> tuple[int, tuple[bytes, ...], tuple[bytes, ...]] | N
at = [index for index, line in enumerate(body) if line[:1] in (b"-", b"+")]
if not at:
return None
first = int(hunks[0]) + sum(not line.startswith(b"+") for line in body[:at[0]])
# Each line before the first changed one is a line of the tree.
first = int(hunks[0]) + at[0]
span = body[at[0]:at[-1] + 1]
was = tuple(line[1:] for line in span if not line.startswith(b"+"))
now = tuple(line[1:].replace(MARK, b"") for line in span if not line.startswith(b"-"))
@@ -87,6 +88,6 @@ def task_text(output: str) -> str | None:
message.append(line.strip())
# A test in a module is named after it, as `tests::adds`; a message may name the whole or the test alone. A Rust test's own
# name is often a plain word, such as `big`, so a longer identifier that holds it, such as `is_big`, doesn't name the test.
names = [re.compile(rf"(?<!\w){re.escape(name)}(?!\w)") for name in {test, test.rpartition("::")[2]} - {""}]
names = [re.compile(rf"(?<!\w){re.escape(name)}(?!\w)") for name in {test, test.rpartition("::")[2]}]
kept = [text for text in message if text and not any(name.search(text) for name in names)]
return "\n".join(kept) or None