generator

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const UnknownPackage = "unknown"

UnknownPackage ...

Variables

This section is empty.

Functions

func Calculate

func Calculate(cfg *config.Config, path string, exclusions *regexp.Regexp)

Calculate test coverage

func DoClean

func DoClean(cfg *config.Config, path string, exclusions *regexp.Regexp)

DoClean will remove the test coverage files

Types

type Cleaner

type Cleaner interface {
	// Clean a single directory
	Single(path string)

	// Recursive will clean a directory and all child directories (excluding any matched be the regex)
	Recursive(path string, exclusions *regexp.Regexp)
}

Cleaner will remove any previously generated coverage files

func NewCleaner

func NewCleaner() Cleaner

NewCleaner returns an instance of the default Cleaner implmentation

type Generator

type Generator struct {
	// BasePath directory to generate coverage for
	BasePath string

	// Exclusion is a regexp match allowing you to exclude/skip some directories from coverage calculation.
	// NOTE: this is ignored in single coverage mode
	Exclusion *regexp.Regexp

	// QuietMode controls how verbose the logging is.  Useful for debugging
	QuietMode bool

	// Race is used to enable --race flag
	Race bool

	// Tags is arguments passed to the go test runner
	Tags string

	// Concurrency controls how many tests can be run concurrently.  Default is `runtime.NumCPU()`
	Concurrency int
}

Generator is the basis for other coverage generators

type GeneratorDo

type GeneratorDo interface {
	Do()
}

GeneratorDo defines the call API of the generators

type RecursiveGenerator

type RecursiveGenerator struct {
	Generator
}

RecursiveGenerator will recursively generated coverage for a tree of directories

func (*RecursiveGenerator) Do

func (g *RecursiveGenerator) Do()

implements pathBuilder interface

type SingleDirGenerator

type SingleDirGenerator struct {
	Generator
}

SingleDirGenerator will generate coverage for a single directory (not recursive)

func (*SingleDirGenerator) Do

func (g *SingleDirGenerator) Do()

implements pathBuilder interface

Jump to

Keyboard shortcuts

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