language

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: MIT Imports: 9 Imported by: ? 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

View Source
var DefaultExecutionTimeout = 5 * time.Minute

DefaultExecutionTimeout defines the timeout for an execution. WORKAROUND For now we define the timeout as a global variable but it should eventually be moved to the "symflower test" command.

View Source
var (
	// ErrCannotParseTestSummary indicates that the test summary cannot be parsed.
	ErrCannotParseTestSummary = errors.New("cannot parse test summary")
)
View Source
var (
	// ErrNoTestFound indicates that no tests could be found.
	ErrNoTestFound = errors.New("no tests could be found")
)

Common errors over all languages.

View Source
var FileRangeMatch = regexp.MustCompile(`^(.+):(\d+):(\d+)-(.+):(\d+):(\d+)$`)

FileRangeMatch match a textual file range with lines and columns.

View Source
var Languages = map[string]Language{}

Languages holds a register of all languages.

Functions

func CoverageObjectCountOfFile added in v0.5.0

func CoverageObjectCountOfFile(logger *log.Logger, coverageFilePath string) (coverageObjectCount uint64, err error)

CoverageObjectCountOfFile parses the given coverage file and returns its coverage object count.

func Register

func Register(language Language)

Register adds a language to the common language list.

func RepositoriesForLanguage added in v0.6.0

func RepositoriesForLanguage(language Language, testdataPath string) (relativeRepositoryPaths []string, err error)

RepositoriesForLanguage returns the relative repository paths for a language.

Types

type CoverageBlockUnfolded added in v0.5.0

type CoverageBlockUnfolded struct {
	// FileRange holds the file range.
	FileRange string
	// CoverageType holds the covered coverage type.
	CoverageType string
	// Count holds the execution count.
	Count uint
}

CoverageBlockUnfolded is an unfolded representation of a coverage data block.

type Language

type Language interface {
	// ID returns the unique ID of this language.
	ID() (id string)
	// Name is the prose name of this language.
	Name() (id string)

	// Files returns a list of relative file paths of the repository that should be evaluated.
	Files(logger *log.Logger, repositoryPath string) (filePaths []string, err error)
	// ImportPath returns the import path of the given source file.
	ImportPath(projectRootPath string, filePath string) (importPath string)
	// TestFilePath returns the file path of a test file given the corresponding file path of the test's source file.
	TestFilePath(projectRootPath string, filePath string) (testFilePath string)
	// TestFramework returns the human-readable name of the test framework that should be used.
	TestFramework() (testFramework string)

	// DefaultFileExtension returns the default file extension of the implemented language.
	DefaultFileExtension() string
	// DefaultTestFileSuffix returns the default test file suffix of the implemented language.
	DefaultTestFileSuffix() string

	// ExecuteTests invokes the language specific testing on the given repository.
	ExecuteTests(logger *log.Logger, repositoryPath string) (testResult *TestResult, problems []error, err error)
	// Mistakes builds a repository and returns the list of mistakes found.
	Mistakes(logger *log.Logger, repositoryPath string) (mistakes []string, err error)
}

Language defines a language to evaluate a repository.

type TestResult added in v0.6.0

type TestResult struct {
	TestsTotal uint
	TestsPass  uint

	Coverage uint64
}

TestResult holds the result of running tests.

func (*TestResult) PassingTestsPercentage added in v0.6.0

func (tr *TestResult) PassingTestsPercentage() (percentage uint)

PassingTestsPercentage returns the percentage of passing tests.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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