testshared

package
v0.0.0-...-3a6be0a Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Analyze

func Analyze(t *testing.T, sourcePath string, rawData []byte)

Analyze analyzes the test expectations ('want'). inspired by https://github.com/golang/tools/blob/b3b5c13b291f9653da6f31b95db100a2e26bd186/go/analysis/analysistest/analysistest.go

func InstallGolangciLint

func InstallGolangciLint(tb testing.TB) string

func NormalizeFileInString

func NormalizeFileInString(in string) string

NormalizeFileInString it's a noop function on Unix.

func NormalizeFilePathInJSON

func NormalizeFilePathInJSON(in string) string

NormalizeFilePathInJSON it's a noop function on Unix.

func SkipOnWindows

func SkipOnWindows(_ testing.TB)

SkipOnWindows it's a noop function on Unix.

Types

type RunContext

type RunContext struct {
	Args           []string
	ConfigPath     string
	ExpectedLinter string
	ExitCode       int
}

RunContext the information extracted from directives.

func ParseTestDirectives

func ParseTestDirectives(tb testing.TB, sourcePath string) *RunContext

ParseTestDirectives parses test directives from sources files.

type Runner

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

func (*Runner) Command

func (r *Runner) Command() *exec.Cmd

func (*Runner) Install

func (r *Runner) Install() *Runner

func (*Runner) Run

func (r *Runner) Run() *RunnerResult

type RunnerBuilder

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

func NewRunnerBuilder

func NewRunnerBuilder(tb testing.TB) *RunnerBuilder

func (*RunnerBuilder) Runner

func (b *RunnerBuilder) Runner() *Runner

func (*RunnerBuilder) WithArgs

func (b *RunnerBuilder) WithArgs(args ...string) *RunnerBuilder

func (*RunnerBuilder) WithBinPath

func (b *RunnerBuilder) WithBinPath(binPath string) *RunnerBuilder

func (*RunnerBuilder) WithCommand

func (b *RunnerBuilder) WithCommand(command string) *RunnerBuilder

func (*RunnerBuilder) WithConfig

func (b *RunnerBuilder) WithConfig(cfg string) *RunnerBuilder

func (*RunnerBuilder) WithConfigFile

func (b *RunnerBuilder) WithConfigFile(cfgPath string) *RunnerBuilder

func (*RunnerBuilder) WithDirectives

func (b *RunnerBuilder) WithDirectives(sourcePath string) *RunnerBuilder

func (*RunnerBuilder) WithEnviron

func (b *RunnerBuilder) WithEnviron(environ ...string) *RunnerBuilder

func (*RunnerBuilder) WithNoConfig

func (b *RunnerBuilder) WithNoConfig() *RunnerBuilder

func (*RunnerBuilder) WithNoParallelRunners

func (b *RunnerBuilder) WithNoParallelRunners() *RunnerBuilder

func (*RunnerBuilder) WithRunContext

func (b *RunnerBuilder) WithRunContext(rc *RunContext) *RunnerBuilder

func (*RunnerBuilder) WithTargetPath

func (b *RunnerBuilder) WithTargetPath(targets ...string) *RunnerBuilder

type RunnerResult

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

func (*RunnerResult) ExpectExitCode

func (r *RunnerResult) ExpectExitCode(possibleCodes ...int) *RunnerResult

func (*RunnerResult) ExpectHasIssue

func (r *RunnerResult) ExpectHasIssue(issueText string) *RunnerResult

func (*RunnerResult) ExpectNoIssues

func (r *RunnerResult) ExpectNoIssues()

func (*RunnerResult) ExpectOutputContains

func (r *RunnerResult) ExpectOutputContains(s ...string) *RunnerResult

func (*RunnerResult) ExpectOutputEq

func (r *RunnerResult) ExpectOutputEq(s string) *RunnerResult

func (*RunnerResult) ExpectOutputNotContains

func (r *RunnerResult) ExpectOutputNotContains(s string) *RunnerResult

func (*RunnerResult) ExpectOutputRegexp

func (r *RunnerResult) ExpectOutputRegexp(s string) *RunnerResult

ExpectOutputRegexp can be called with either a string or compiled regexp

Jump to

Keyboard shortcuts

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