tt

package module
v0.0.0-...-c9feb8c Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestMode

func TestMode() bool

TestMode returns true if run as unit test

Types

type Middleware

type Middleware = func(f TestFunction) TestFunction

Middleware is a filter/wrap function add common behaviors to test function.

func AfterFP

func AfterFP(after func()) Middleware

AfterFP FP version of After.

func BeforeAfterFP

func BeforeAfterFP(before func(), after func()) Middleware

BeforeAfterFP FP version of BeforeAfter

func BeforeFP

func BeforeFP(before func()) Middleware

BeforeFP returns a function that wraps

func CloserFP

func CloserFP(fClosable func() io.Closer) Middleware

CloserFP FP version of Closer().

type TestFunction

type TestFunction = func(t *testing.T)

TestFunction function to run by testing.T.Run()

func After

func After(after func(), f TestFunction) TestFunction

After run after function after test function, even if panic

func Before

func Before(before func(), f TestFunction) TestFunction

Before wraps a testing.Run() function that runs before function before test.

func BeforeAfter

func BeforeAfter(before func(), after func(), f TestFunction) TestFunction

BeforeAfter run before after function before/after test function, after function called even test function paniced.

func Closer

func Closer(fClosable func() io.Closer, f TestFunction) TestFunction

Closer use Closer interface to do BeforeAfter.

Put before operation in closable function, put after operation in returned Closer.Close() method.

Jump to

Keyboard shortcuts

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