Documentation ¶
Index ¶
- func AssertNoError(t *testing.T, err error)
- func AssertNotPanics(t *testing.T, f func())
- func AssertPanicsWith(t *testing.T, errStr string, f func())
- func RequireNoError(t *testing.T, err error)
- func RequireNotPanics(t *testing.T, f func())
- func RequirePanicsWith(t *testing.T, errStr string, f func())
- func RunSuite(t *testing.T, s Suite)
- type AfterSuite
- type AfterTest
- type BeforeSuite
- type BeforeTest
- type Config
- type DefaultConfigMixin
- type OutputCapture
- type Suite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertNoError ¶
AssertNoError is like assert.NoError, with proper handling of github.com/ibrt/golang-errors errors.
func AssertNotPanics ¶
AssertNotPanics is like assert.NotPanics, with proper handling of github.com/ibrt/golang-errors errors.
func AssertPanicsWith ¶ added in v1.2.0
AssertPanicsWith is like assert.PanicsWithError, with proper handling of github.com/ibrt/golang-errors errors.
func RequireNoError ¶
RequireNoError is like require.NoError, with proper handling of github.com/ibrt/golang-errors errors.
func RequireNotPanics ¶
RequireNotPanics is like require.NotPanics, with proper handling of github.com/ibrt/golang-errors errors.
func RequirePanicsWith ¶ added in v1.2.0
RequirePanicsWith is like require.PanicsWithError, with proper handling of github.com/ibrt/golang-errors errors.
Types ¶
type AfterSuite ¶
AfterSuite represents a method invoked after completing a test suite.
type BeforeSuite ¶
BeforeSuite describes a method invoked before starting a test suite.
type BeforeTest ¶
BeforeTest represents a method invoked before each test method in a suite.
type Config ¶
type Config struct { // SkipWarnings indicates whether to print suite-generated warnings, e.g. a list of fields and methods on the suite // struct that are not considered helpers or test methods. SkipWarnings bool // Logf is the to be used to print suite-generated warnings. If unset, the suite defaults to `t.Logf`. Logf func(string, ...interface{}) }
Config allows to customize the behavior of the suite runner.
type DefaultConfigMixin ¶
type DefaultConfigMixin struct { }
DefaultConfigMixin implements the Suite interface returning a default config.
func (*DefaultConfigMixin) Suite ¶
func (*DefaultConfigMixin) Suite() Config
Suite implements the Suite interface.
type OutputCapture ¶ added in v1.1.0
type OutputCapture struct {
// contains filtered or unexported fields
}
OutputCapture can be used to capture standard output and standard error.
func CaptureOutput ¶ added in v1.1.0
func CaptureOutput() *OutputCapture
CaptureOutput captures the output in tests. Always defer OutputCapture.Close() right after CaptureOutput is called.
func (*OutputCapture) Close ¶ added in v1.1.0
func (c *OutputCapture) Close()
Close finalizes the capture by flushing/caching all buffers and restoring the original stdout/sterr.
func (*OutputCapture) GetErr ¶ added in v1.1.0
func (c *OutputCapture) GetErr() []byte
GetErr calls Close and returns the captured standard error.
func (*OutputCapture) GetErrString ¶ added in v1.1.0
func (c *OutputCapture) GetErrString() string
GetErrString calls Close and returns the captured standard error as string.
func (*OutputCapture) GetOut ¶ added in v1.1.0
func (c *OutputCapture) GetOut() []byte
GetOut calls Close and returns the captured standard output.
func (*OutputCapture) GetOutString ¶ added in v1.1.0
func (c *OutputCapture) GetOutString() string
GetOutString calls Close and returns the captured standard output as string.