gomutatedfile

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Differ

type Differ interface {
	Diff(a, b string, aData, bData []byte) string
}

type GoMutatedFile

type GoMutatedFile struct {
	// contains filtered or unexported fields
}

func New

func New(infectionName, relativePath string, rawSourceContent, rawMutatedContent []byte) *GoMutatedFile

func (*GoMutatedFile) Address added in v0.3.0

func (f *GoMutatedFile) Address() string

Address is where a reader has to look: `path:line:col`, or the path alone when no difference could be read.

func (*GoMutatedFile) Change added in v0.3.0

func (f *GoMutatedFile) Change() string

Change is the replacement itself, `original → mutated`, on one line. It is empty when there is no difference to describe.

func (*GoMutatedFile) Diff

func (f *GoMutatedFile) Diff(differ Differ) string

func (*GoMutatedFile) Label

func (f *GoMutatedFile) Label() string

Label names one mutant. It is the subtest's name and the survivor's headline, so it carries the address: `go test` separates repeated subtest names with #01 and #02, which told a reader that two mutants differed and nothing about where either of them was.

func (*GoMutatedFile) Mutated added in v0.3.0

func (f *GoMutatedFile) Mutated() []byte

Mutated is the file as this mutant leaves it.

The gated path needs the bytes rather than the effect of writing them: it reads what a virus replaced off the difference between these and the original, instead of asking each of the fourteen viruses what it does.

func (*GoMutatedFile) Path added in v0.3.0

func (f *GoMutatedFile) Path() string

func (*GoMutatedFile) RestoreIn added in v0.2.0

func (f *GoMutatedFile) RestoreIn(repository Repository)

RestoreIn puts the original bytes back where WriteTo put the mutated ones.

It is what lets one temporary repository serve every mutant instead of being rebuilt for each: a sandbox that is handed back carrying the previous mutation would silently test two mutations at once.

func (*GoMutatedFile) Source added in v0.3.0

func (f *GoMutatedFile) Source() []byte

Source is the file before this mutant touched it, and Path is where it lives.

The gated path needs both: it plans one instrumented file from the original and every mutant of it, and writes that file back where the original was.

func (*GoMutatedFile) String

func (f *GoMutatedFile) String() string

func (*GoMutatedFile) Virus added in v0.7.0

func (f *GoMutatedFile) Virus() string

Virus is the mutation operator that produced this file.

It is what somebody fixes when a mutant does not compile: the rate has an external benchmark -- Major 1.8%, PIT 0% -- and a rate alone names no work. docs/metrics.md metric 1.

func (*GoMutatedFile) WriteTo

func (f *GoMutatedFile) WriteTo(repository Repository)

type Repository

type Repository interface {
	Overwrite(filePath string, data []byte)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL