Muex.Mutator.Guard (Muex v0.8.0)

View Source

Elixir-specific mutator that removes a when guard constraint.

  • def f(x) when <guard> -> def f(x) when true

Replaces the guard expression of a when clause with the literal true, so the clause matches unconditionally. Type guards (is_integer/1, is_binary/1, …) and custom guard expressions are otherwise invisible to the operator-level mutators, so a surviving mutant here means a guard's constraint is never exercised by the tests.

Comparison and boolean sub-expressions inside a guard are still mutated independently by their own mutators as walk/3 traverses into them.