Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyMutant ¶ added in v0.7.2
func ApplyMutant(filename string, original []byte, start, end int, replacement string) ([]byte, error)
ApplyMutant is Apply for a mutant of the Go file filename: it also puts back to use any import or local variable whose last use the replacement removed. Go rejects an unused import or local, so without this a mutant such as RETURN_ZERO's `return "n" + strconv.Itoa(n)` → `return ""` fails to compile on the now-unused strconv and reads NOT VIABLE, though the mutation itself is valid and the tests never saw it.
The repairs change no behaviour: an import is blanked (`_ "strconv"`), which still runs its init, and a local is read once (`_ = x`). Both are written on the line they belong to, so no line number moves. Likewise a replacement that would fuse with a neighbouring token in unformatted source is spaced off from it first (see keepApart).
Types ¶
This section is empty.