Muex. Mutator. ReturnValue
(Muex v0.7.0)
View Source
Mutator that replaces function return values with type-appropriate zero values.
Targets def and defp function definitions. For multi-statement
bodies (__block__), replaces the last expression. For single-expression
bodies, replaces the entire body.
The replacement value is inferred from the shape of the original return
expression to preserve the caller's type expectations and avoid spurious
MatchError / FunctionClauseError crashes that would mask real
mutation-testing signal:
{:ok, _}→{:error, :mutated}{:error, _}→{:ok, :mutated}:ok→:error:error→:oktrue→falsefalse→true- integer →
0 - float →
0.0 - string →
"" - list →
[] - map/struct →
%{} - tuple →
{} - everything else →
nil
Skips functions whose return expression already matches the zero value.
Complements StatementDeletion: that mutator tests whether intermediate statements matter, this one tests whether the return value matters.