test

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: BSD-3-Clause Imports: 6 Imported by: 1

Documentation

Overview

Package test provides testable errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error []error

Error for this package.

func (Error) Error

func (err Error) Error() string

func (Error) Test

func (err Error) Test(t State)

Test tests if there is an error and if there is, it fatally fails the current test.

type State

type State interface {
	Cleanup(f func())
	Deadline() (deadline time.Time, ok bool)
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Fail()
	FailNow()
	Failed() bool
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	Helper()
	Log(args ...interface{})
	Logf(format string, args ...interface{})
	Name() string
	Parallel()
	Run(name string, f func(t *testing.T)) bool
	Skip(args ...interface{})
	SkipNow()
	Skipf(format string, args ...interface{})
	Skipped() bool
	TempDir() string
}

State is an interface of *testing.T

func Discard

func Discard() State

Discard returns a state that discards all operations.

type Suite

type Suite interface {
	T() *testing.T
	SetT(*testing.T)
}

Suite can be embedded inside of a type to turn it into a testsuite. Any methods beginning with Test are run when testing.

type Test

type Test func(*testing.T)

Test is a testing function.

func New

func New(testsuite Suite) Test

New allows a test to be created from a Suite.

Jump to

Keyboard shortcuts

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