Drops the last clause of a case or cond expression.
Per mutagen.mutators catalog entry 6.
AST shape
case subject do C1 -> R1; C2 -> R2 end parses as
{:case, meta, [subject, [do: [
{:->, meta, [[pattern1], result1]},
{:->, meta, [[pattern2], result2]}
]]]}cond do C1 -> R1; C2 -> R2 end parses similarly with :cond and a single
expression in each clause's pattern list.
Drop
We drop the last clause. Dropping the catch-all or wildcard is what changes observable behaviour for the most realistic call sites. Dropping the only clause would yield invalid AST so we skip those.
Validation
:structurally_invalid—case/condwith only one clause (dropping it leaves an emptydoblock, which does not compile).:no_op_shadowed—case/condwhose remaining clauses still cover every value that reaches the expression. The catalog cannot prove coverage in general; in v1 we conservatively skip nothing here so the runner's:survivedcount remains an honest upper bound. Users should interpret a survivingcase_dropmutation as "test suite did not distinguish the dropped branch from the remaining branches".
Runtime classification
Per mutagen.mutators.r8 / mutagen.mutation_pipeline.r5: when the
dropped clause was the only one matching a value the program actually
produces (the canonical guarded-recursive-base-case pattern is a
case with a guarded recursive clause plus an unguarded base clause;
dropping the base leaves only the guarded clause), the mutated module
raises CaseClauseError at runtime and the mutation pipeline
classifies the site :killed, not :timeout. :case_drop is
therefore NOT a reliable trigger for :timeout-classified mutations.
Fixtures requiring deterministic :timeout (e.g.,
test/fixtures/lane_project/lib/lane_fixture/infinite_looper.ex)
should use :arith against a recursive descent so the recursion truly
diverges without encountering a clause-miss.