internal

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheFlush added in v0.34.2

func CacheFlush()

func InGoroutine added in v0.23.0

func InGoroutine(fn func())

func RegisterCacheFlush added in v0.34.2

func RegisterCacheFlush(fn func()) struct{}

func SetupCacheFlush added in v0.34.2

func SetupCacheFlush(tb testing.TB)

func SymbolicName added in v0.48.0

func SymbolicName(T interface{}) string

Types

type RecorderTB added in v0.19.0

type RecorderTB struct {
	testing.TB
	IsFailed bool
	Config   struct {
		Passthrough bool
	}
	// contains filtered or unexported fields
}

func (*RecorderTB) Cleanup added in v0.19.0

func (rtb *RecorderTB) Cleanup(f func())

func (*RecorderTB) CleanupNow added in v0.23.0

func (rtb *RecorderTB) CleanupNow()

func (*RecorderTB) Error added in v0.19.0

func (rtb *RecorderTB) Error(args ...interface{})

func (*RecorderTB) Errorf added in v0.19.0

func (rtb *RecorderTB) Errorf(format string, args ...interface{})

func (*RecorderTB) Fail added in v0.19.0

func (rtb *RecorderTB) Fail()

func (*RecorderTB) FailNow added in v0.19.0

func (rtb *RecorderTB) FailNow()

func (*RecorderTB) Failed added in v0.19.0

func (rtb *RecorderTB) Failed() bool

func (*RecorderTB) Fatal added in v0.19.0

func (rtb *RecorderTB) Fatal(args ...interface{})

func (*RecorderTB) Fatalf added in v0.19.0

func (rtb *RecorderTB) Fatalf(format string, args ...interface{})

func (*RecorderTB) Forward added in v0.23.1

func (rtb *RecorderTB) Forward()

func (*RecorderTB) Helper added in v0.19.0

func (rtb *RecorderTB) Helper()

func (*RecorderTB) Log added in v0.19.0

func (rtb *RecorderTB) Log(args ...interface{})

func (*RecorderTB) Logf added in v0.19.0

func (rtb *RecorderTB) Logf(format string, args ...interface{})

func (*RecorderTB) Run added in v0.23.0

func (rtb *RecorderTB) Run(_ string, blk func(testing.TB)) bool

type StubTB

type StubTB struct {
	// TB is only present here to implement testing.TB interface's
	// unexported functions by embedding the interface itself.
	testing.TB

	IsFailed  bool
	IsSkipped bool
	Logs      []string

	StubName    string
	StubTempDir string
	StubFailNow func()
	// contains filtered or unexported fields
}

func (*StubTB) Cleanup

func (m *StubTB) Cleanup(f func())

func (*StubTB) Error

func (m *StubTB) Error(args ...interface{})

func (*StubTB) Errorf

func (m *StubTB) Errorf(format string, args ...interface{})

func (*StubTB) Fail

func (m *StubTB) Fail()

func (*StubTB) FailNow

func (m *StubTB) FailNow()

func (*StubTB) Failed

func (m *StubTB) Failed() bool

func (*StubTB) Fatal

func (m *StubTB) Fatal(args ...interface{})

func (*StubTB) Fatalf

func (m *StubTB) Fatalf(format string, args ...interface{})

func (*StubTB) Finish added in v0.23.1

func (m *StubTB) Finish()

func (*StubTB) Helper

func (m *StubTB) Helper()

func (*StubTB) Log

func (m *StubTB) Log(args ...interface{})

func (*StubTB) Logf

func (m *StubTB) Logf(format string, args ...interface{})

func (*StubTB) Name

func (m *StubTB) Name() string

func (*StubTB) Skip

func (m *StubTB) Skip(args ...interface{})

func (*StubTB) SkipNow

func (m *StubTB) SkipNow()

func (*StubTB) Skipf

func (m *StubTB) Skipf(format string, args ...interface{})

func (*StubTB) Skipped

func (m *StubTB) Skipped() bool

func (*StubTB) TempDir

func (m *StubTB) TempDir() string

type Teardown added in v0.38.0

type Teardown struct {
	CallerOffset int
	// contains filtered or unexported fields
}

func (*Teardown) Defer added in v0.38.0

func (td *Teardown) Defer(fn interface{}, args ...interface{})

Defer function defers the execution of a function until the current test case returns. Deferred functions are guaranteed to run, regardless of panics during the test case execution. Deferred function calls are pushed onto a testcase runtime stack. When an function passed to the Defer function, it will be executed as a deferred call in last-in-first-orderingOutput order.

It is advised to use this inside a testcase.Spec#Let memorization function when spec variable defined that has finalizer requirements. This allow the specification to ensure the object finalizer requirements to be met, without using an testcase.Spec#After where the memorized function would be executed always, regardless of its actual need.

In a practical example, this means that if you have common vars defined with testcase.Spec#Let memorization, which needs to be Closed for example, after the test case already run. Ensuring such objects Close call in an after block would cause an initialization of the memorized object list the time, even in tests where this is not needed.

e.g.:

  • mock initialization with mock controller, where the mock controller #Finish function must be executed after each testCase suite.
  • sql.DB / sql.Tx
  • basically anything that has the io.Closer interface

func (*Teardown) Finish added in v0.38.0

func (td *Teardown) Finish()

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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