Documentation ¶
Overview ¶
Package mocktesting contains a mock instance of *testing.T which is useful for testing interchaintest's interactions with Go tests.
Index ¶
- type T
- func (t *T) Cleanup(f func())
- func (t *T) Errorf(format string, args ...any)
- func (t *T) Fail()
- func (t *T) FailNow()
- func (t *T) Failed() bool
- func (t *T) Helper()
- func (t *T) Logf(format string, args ...any)
- func (t *T) Name() string
- func (t *T) Parallel()
- func (t *T) RunCleanups()
- func (t *T) Simulate(fn func())
- func (t *T) Skip(args ...any)
- func (t *T) Skipped() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type T ¶
type T struct { HelperCalled bool Logs []string Errors []string Skips []string // ParallelDelay sets how long to sleep on a call to t.Parallel, // for tests that need to simulate t.Parallel blocking. ParallelDelay time.Duration // contains filtered or unexported fields }
T satisfies a subset of testing.TB useful for tests around how interchaintest interacts with instances of testing.T.
The methods that are unique to T are RunCleanups and Simulate
func (*T) Cleanup ¶
func (t *T) Cleanup(f func())
Cleanup adds f to the list of cleanup functions to invoke. To actually invoke the functions, use t.RunCleanups.
func (*T) FailNow ¶
func (t *T) FailNow()
FailNow marks T as failed and stops execution. FailNow panics if called outside the context of RunTest.
func (*T) Parallel ¶
func (t *T) Parallel()
Parallel blocks for the configured t.ParallelDelay and then returns.
func (*T) RunCleanups ¶
func (t *T) RunCleanups()
RunCleanups runs all the functions passed to t.Cleanup, in reverse order just like the real testing.T.
func (*T) Simulate ¶
func (t *T) Simulate(fn func())
Simulate executes the given function in its own goroutine, which is necessary for exercising methods that affect control flow, such as t.Skip or t.FailNow.
Simulate also runs t.RunCleanups after fn's execution finishes.