gomutatedfile

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 4 Imported by: 0

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) 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