test

package module
v0.0.0-...-56ec4c2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: BSD-3-Clause Imports: 12 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.

README

test

Documentation

Overview

Package test provides infrastructure for creating templated tests that may driven by the go test framework. A test implements Interface and comprises a set of named test vectors forming a Suite.

Index

Constants

This section is empty.

Variables

View Source
var ErrBadPhase = errors.New("phase number out of range")

Functions

func RunGoTests

func RunGoTests(t *testing.T, dataroot string, fail FailCommands, packages []Package)

Types

type Array

type Array []Params

func (*Array) Add

func (a *Array) Add(v interface{})

func (Array) Params

func (a Array) Params(id int) Params

type FailCommands

type FailCommands struct {
	Phase func(string, int) string
	Test  func(string, int, int) string
}

type Interface

type Interface interface {
	Setup(int) error
	Vector() Vector
	Run(require.TestingT, Params)
	Teardown(int) error
	// true if this test shouldn't be run on a "short" pass
	IsLong() bool
}

type Long

type Long struct{}

func (*Long) IsLong

func (p *Long) IsLong() bool

type NopTeardown

type NopTeardown struct{}

func (*NopTeardown) Teardown

func (p *NopTeardown) Teardown(phase int) error

type Package

type Package struct {
	Name   string
	Test   Interface
	Phases int
	// Baseline is nil for test packages that do not save their baseline
	// to the file system.  Otherwise, Baseline is a function that returns
	// an blank vector that can be used with json.Unmarshal so we get
	// proper type of json of objects instead of generic maps and arrays.
	Baseline func() Vector
	Dir      string
	Logger   *zap.Logger
	Terminal io.Writer
}

func (*Package) CheckPhase

func (p *Package) CheckPhase(phase int) error

func (*Package) LoadBaseline

func (p *Package) LoadBaseline(path string) (Vector, error)

func (*Package) NumPhases

func (p *Package) NumPhases() int

func (*Package) PostVector

func (p *Package) PostVector(phase int) (Vector, error)

func (*Package) PreVector

func (p *Package) PreVector() Vector

func (*Package) Run

func (p *Package) Run(phase, id int, params Params) error

func (*Package) RunVector

func (p *Package) RunVector(vector []Params, phase int) error

func (*Package) SaveBaseline

func (p *Package) SaveBaseline(path string, v interface{}) error

func (*Package) SetupPhase

func (p *Package) SetupPhase(targetPhase int) error

func (*Package) UpdateBaseline

func (p *Package) UpdateBaseline() error

type Params

type Params interface{}

func VectorParams

func VectorParams(v Vector) []Params

type Short

type Short struct{}

func (*Short) IsLong

func (p *Short) IsLong() bool

type Suite

type Suite []Package

func (Suite) LookupPackage

func (s Suite) LookupPackage(name string) (*Package, error)

func (Suite) LookupTest

func (s Suite) LookupTest(name string, phase, id int) (*Package, Params, error)

func (Suite) Run

func (s Suite) Run(name string, phase, id int) error

func (Suite) RunAll

func (s Suite) RunAll(dataroot, name string) error

type T

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

T implements the require.TestingT interface

func (*T) Errorf

func (t *T) Errorf(format string, args ...interface{})

func (*T) FailNow

func (t *T) FailNow()

type Vector

type Vector interface {
	Params(id int) Params
}

Jump to

Keyboard shortcuts

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