Muex. Mutator. Literal
(Muex v0.7.0)
View Source
Mutator for literal values.
Applies mutations to literals:
- Numeric literals: increment/decrement by 1
- String literals: empty string, change character
- List literals: empty list
- Atom literals: change to different atom (except special atoms)
Location
Bare literals carry no AST metadata of their own, so this mutator reads
the enclosing source line from context[:line] (populated by
Muex.Mutator.walk/3), falling back to 0 when no context line is
available. This lets reports point at the literal's actual line instead
of line: 0.
Skipped atoms
Module alias segments (atoms whose name starts with an uppercase letter,
e.g. :Phoenix, :Component) are never mutated: they are structural
metadata, and mutating them produces invalid mutants. The traversal in
Muex.Mutator.walk/3 already prunes __aliases__ subtrees; this guard
is a defensive backstop for alias atoms reached by other paths. The
special atoms nil, true, false, :ok, and :error are likewise
left untouched.