Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchLaboratory ¶ added in v0.3.0
type BatchLaboratory interface {
TestAll(repository Repository, files []*gomutatedfile.GoMutatedFile) []future.Future[result.Result[string]]
}
BatchLaboratory is handed every mutant of one file together.
One compilation can only serve several mutants if the compiler is given all of them at once, and the gated path needs exactly that. It is a separate interface rather than a change to Laboratory so that every laboratory that exists today goes on being asked one mutant at a time, unchanged.
The batch cannot be assembled lower down. Test returns a future, and a laboratory could in principle buffer and resolve later — but testingtlaboratory awaits inside each subtest, immediately, so a laboratory waiting for mutants that have not been submitted yet would wait forever.
type Diagnostic ¶
type Diagnostic struct {
// contains filtered or unexported fields
}
func NewDiagnostic ¶
func NewDiagnostic(res future.Future[result.Result[string]], file *gomutatedfile.GoMutatedFile) *Diagnostic
func (*Diagnostic) Address ¶ added in v0.3.0
func (d *Diagnostic) Address() string
Address and Change are what a survivor is reported as before any diff is rendered: where it is, and what it wrote there.
func (*Diagnostic) Change ¶ added in v0.3.0
func (d *Diagnostic) Change() string
func (*Diagnostic) Diff ¶
func (d *Diagnostic) Diff(differ gomutatedfile.Differ) string
func (*Diagnostic) IsOk ¶
func (d *Diagnostic) IsOk() bool
func (*Diagnostic) Label ¶
func (d *Diagnostic) Label() string
type Ditto ¶
type Ditto struct {
// contains filtered or unexported fields
}
func New ¶
func New(repository Repository, laboratory Laboratory, reporter Reporter) *Ditto
func (*Ditto) Release ¶
Release mutates every source file and reports what each mutant did.
Mutants are kept together by the file they came from, because a laboratory that compiles once for a whole file has to receive the file's mutants at once. The order they are reported in is unchanged: sources are walked in order, and each file's mutants in the order its viruses produced them.
type Laboratory ¶
type Laboratory interface {
Test(repository Repository, file *gomutatedfile.GoMutatedFile) future.Future[result.Result[string]]
}
type RefusalError ¶ added in v0.4.0
type RefusalError struct {
// contains filtered or unexported fields
}
RefusalError is the one thing a release says by stopping.
A laboratory that finds the suite already red cannot return that finding: Test hands back a future of a result, and every value in it means something about a mutant. There is no mutant here — the run has not started, and scoring anything would be scoring a suite that tested nothing. So it panics, and the panic is the verdict rather than a defect.
It is a type rather than a string because the two entry points need different things from it. Release lets it through, so a test fails with the message printed as the panic value. Run has to turn it into an error, and recognising it by matching text would tie the entry point to a sentence somebody will reword.
func NewRefusalError ¶ added in v0.4.0
func NewRefusalError(message string) RefusalError
NewRefusalError builds the refusal a laboratory panics with.
func (RefusalError) Error ¶ added in v0.4.0
func (r RefusalError) Error() string
Error is the message, and is what both the panic printer and Run report.
type Reporter ¶
type Reporter interface {
AddDiagnostic(diagnostic *Diagnostic)
Summarize() result.Result[any]
}
type Repository ¶
type Repository interface {
ListGoSourceFiles() []*gosourcefile.GoSourceFile
LinkAllToTemporaryRepository(temporaryPath string) TemporaryRepository
}