cmd

package
v0.101.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: MIT Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultInfluxDBHost = "http://localhost:9999"

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func TestCommand added in v0.101.0

func TestCommand(setup TestSetupFunc) *cobra.Command

Types

type Test added in v0.99.0

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

Test wraps the functionality of a single testcase statement, to handle its execution and its pass/fail state.

func NewTest added in v0.99.0

func NewTest(ast *ast.Package) Test

NewTest creates a new Test instance from an ast.Package.

func (*Test) Error added in v0.99.0

func (t *Test) Error() error

Get the error from the test, if one exists.

func (*Test) Name added in v0.99.0

func (t *Test) Name() string

Get the name of the Test.

func (*Test) Run added in v0.99.0

func (t *Test) Run(executor TestExecutor)

Run the test, saving the error to the err property of the struct.

type TestExecutor added in v0.101.0

type TestExecutor interface {
	Run(pkg *ast.Package) error
	io.Closer
}

func NewTestExecutor added in v0.101.0

func NewTestExecutor(ctx context.Context) (TestExecutor, error)

type TestReporter added in v0.99.0

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

TestReporter handles reporting of test results.

func NewTestReporter added in v0.99.0

func NewTestReporter(verbosity int) TestReporter

NewTestReporter creates a new TestReporter with a provided verbosity.

func (*TestReporter) ReportTestRun added in v0.99.0

func (t *TestReporter) ReportTestRun(test *Test)

ReportTestRun reports the result a single test run, intended to be run as each test is run.

func (*TestReporter) Summarize added in v0.99.0

func (t *TestReporter) Summarize(tests []*Test)

Summarize summarizes the test run.

type TestRunner added in v0.99.0

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

TestRunner gathers and runs all tests.

func NewTestRunner added in v0.99.0

func NewTestRunner(reporter TestReporter) TestRunner

NewTestRunner returns a new TestRunner.

func (*TestRunner) Finish added in v0.99.0

func (t *TestRunner) Finish()

Finish summarizes the test run, and returns the exit code based on success for failure.

func (*TestRunner) Gather added in v0.99.0

func (t *TestRunner) Gather(rootDir string, names []string) error

Gather gathers all tests from the filesystem and creates Test instances from that info.

func (*TestRunner) Run added in v0.99.0

func (t *TestRunner) Run(executor TestExecutor, verbosity int)

Run runs all tests, reporting their results.

type TestSetupFunc added in v0.101.0

type TestSetupFunc func(ctx context.Context) (TestExecutor, error)

Jump to

Keyboard shortcuts

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