Documentation
¶
Index ¶
- type B
- type BenchFunc
- type Logger
- type Middleware
- type RunFunc
- type Runner
- type T
- type TestFunc
- type W
- func (w *W[T]) BaseName() string
- func (w *W[T]) Cleanup(f func())
- func (w *W[T]) Context() context.Context
- func (w *W[T]) Error(args ...any)
- func (w *W[T]) Errorf(format string, args ...any)
- func (w *W[T]) Fail()
- func (w *W[T]) FailNow()
- func (w *W[T]) Failed() bool
- func (w *W[T]) Fatal(args ...any)
- func (w *W[T]) Fatalf(format string, args ...any)
- func (w *W[T]) Helper()
- func (w *W[T]) Log(args ...any)
- func (w *W[T]) Logf(format string, args ...any)
- func (w *W[T]) Name() string
- func (w *W[T]) Run(name string, fn RunFunc[T]) bool
- func (w *W[T]) RunSuite(s any)
- func (w *W[T]) Skip(args ...any)
- func (w *W[T]) SkipNow()
- func (w *W[T]) Skipf(format string, args ...any)
- func (w *W[T]) Skipped() bool
- func (w *W[T]) TempDir() string
- func (w *W[T]) Unwrap() T
- func (w *W[T]) Using(m ...Middleware[T]) *W[T]
- func (w *W[T]) WithContext(ctx context.Context) *W[T]
- func (w *W[T]) WithLogger(l Logger) *W[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶ added in v0.0.2
type Logger interface {
Log(args ...any)
Logf(format string, args ...any)
Error(args ...any)
Errorf(format string, args ...any)
}
Logger represents something that can receive test log messages
type Middleware ¶
Middleware represents a function that can wrap a test function
func WithParallel ¶
func WithParallel() Middleware[*testing.T]
WithParallel creates middleware that runs tests in parallel
func WithTimeout ¶
func WithTimeout[T Runner[T]](d time.Duration) Middleware[T]
WithTimeout creates middleware that adds a timeout to the test context
type W ¶
type W[T Runner[T]] struct { // contains filtered or unexported fields }
W is a context-aware wrapper for test/benchmark types
func New ¶
func New[T Runner[T]](t T, middleware ...Middleware[T]) *W[T]
New creates a new context-aware test helper
func (*W[T]) Cleanup ¶
func (w *W[T]) Cleanup(f func())
Cleanup registers a function to be called when the test completes
func (*W[T]) Using ¶ added in v0.0.2
func (w *W[T]) Using(m ...Middleware[T]) *W[T]
Using returns a new wrapper with the given middleware
func (*W[T]) WithContext ¶
WithContext creates a new wrapper with the given context
func (*W[T]) WithLogger ¶ added in v0.0.2
WithLogger returns a new wrapper with the given logger
Click to show internal directories.
Click to hide internal directories.