workdir

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package workdir manages temporary working directories for isolated mutation testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedDealer

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

CachedDealer is the implementation of the Dealer interface, responsible for creating a working directory of a source directory. It allows Gremlins not to work in the actual source directory messing up with the source code files.

func NewCachedDealer

func NewCachedDealer(workDir, srcDir string) *CachedDealer

NewCachedDealer instantiates a new Dealer that keeps a cache of the instantiated folders. Every time a new working directory is requested with the same identifier, the same folder reference is returned.

func (*CachedDealer) Clean

func (cd *CachedDealer) Clean()

Clean frees all the cached folders and removes all of them from disk.

func (*CachedDealer) Discard added in v0.8.0

func (cd *CachedDealer) Discard(idf string) error

Discard removes the cached folder of idf from the cache and from disk. The next Get for idf creates a new copy of the source directory, also when the removal from disk fails.

func (*CachedDealer) Get

func (cd *CachedDealer) Get(idf string) (string, error)

Get provides a working directory where all the files are full copies to the original files in the source directory.

func (*CachedDealer) WorkDir

func (cd *CachedDealer) WorkDir() string

WorkDir provides the root working directory.

type Dealer

type Dealer interface {
	// Get returns the folder of idf that Gremlins uses as workdir.
	Get(idf string) (string, error)
	// Discard removes the folder of idf. The next Get for idf returns a
	// new copy.
	Discard(idf string) error
	// Clean removes all the created folders.
	Clean()
	// WorkDir returns the root working directory.
	WorkDir() string
}

Dealer is the responsible for creating and returning the reference to a workdir to use during mutation testing instead of the actual source code.

The caller must call Clean to remove all the created folders.

Jump to

Keyboard shortcuts

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