Kill the Clojure site survivors instead of leaving them.

A reader quote is a quoting_lit, so '(+ 1 0) was not covered by the
(quote ...) test. The skip returned True there and the mutant survived.
A + inside a vector is not a call, a symbol True is not a boolean, and
the anchor of a Clojure site is its own line.

_clojure_text repeated its type check with a child-count clause, and
_is_head's final return never ran because the symbol is a child of its
list. Both are gone.

Proved by the Clojure site tests. mutator on src/mutator/sites.py then
scored 66 killed, 0 survived, 0 uncovered. The suite passes (119 tests,
and the SwiftPM run is skipped because swift is not installed).

Co-authored-by: Robert C. Martin <[email protected]>
This commit is contained in:
Cursor Agent
2026-11-26 01:04:26 +00:00
co-authored by Robert C. Martin
parent b494411b07
commit 8118590503
2 changed files with 18 additions and 3 deletions
+15
View File
@@ -29,6 +29,8 @@ def test_clojure_rules_follow_clj_mutate_and_mark_private_defns(tmp_path):
assert ("defn/place", "1", "0") in described
assert ("defn-/hide", "false", "true") in described
assert {site.namespace for site in sites} == {"demo.core"}
plus = [site for site in sites if site.original == "+"]
assert [site.anchor_line for site in plus] == [4]
functions = project_functions(source, tmp_path / "src/demo/core.clj", tmp_path)
assert form_id("hide", True) == "defn-/hide"
assert is_private("clojure", "hide", source, 6, 7)
@@ -40,12 +42,25 @@ def test_clojure_ignores_strings_comments_and_quotes(tmp_path):
(defn place []
(comment (+ 1 0))
(quote (+ 1 0))
'(+ 1 0)
(str "true + 1"))
"""
sites = _sites(tmp_path, "src/demo/core.clj", source)
assert sites == []
def test_a_clojure_vector_and_a_capitalized_symbol_are_not_calls(tmp_path):
source = """(defn place []
[+ 1]
True)
"""
sites = _sites(tmp_path, "src/demo/core.clj", source)
described = {(site.original, site.mutant) for site in sites}
assert ("+", "-") not in described
assert ("True", "False") not in described
assert ("1", "0") in described
def test_java_rules_follow_mutate4java(tmp_path):
source = """package demo;
class Board {