Documentation ¶
Index ¶
- type AssertData
- type AssertFlush
- type AssertHandler
- func (a *AssertHandler) AddAssertData(key string, value AssertData)
- func (a *AssertHandler) AddAssertFlush(flusher AssertFlush)
- func (a *AssertHandler) Assert(ctx context.Context, truth bool, msg string, data ...any)
- func (a *AssertHandler) AssertWithTimeout(ctx context.Context, timeout time.Duration, truth bool, msg string, ...)
- func (a *AssertHandler) Never(ctx context.Context, msg string, data ...any)
- func (a *AssertHandler) Nil(ctx context.Context, item any, msg string, data ...any)
- func (a *AssertHandler) NoError(ctx context.Context, err error, msg string, data ...any)
- func (a *AssertHandler) NotNil(ctx context.Context, item any, msg string, data ...any)
- func (a *AssertHandler) ProcessDeferredAssertions(ctx context.Context)
- func (a *AssertHandler) RemoveAssertData(key string)
- func (a *AssertHandler) SetDeferAssertions(deferMode bool)
- func (a *AssertHandler) SetExitFunc(exitFunc func(int))
- func (a *AssertHandler) SetFormatter(formatter Formatter)
- func (a *AssertHandler) ToWriter(w io.Writer)
- type Formatter
- type JSONFormatter
- type TextFormatter
- type YAMLFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssertData ¶
type AssertData interface {
Dump() string
}
Define interfaces for logging/asserting
type AssertFlush ¶
type AssertFlush interface {
Flush()
}
type AssertHandler ¶
type AssertHandler struct {
// contains filtered or unexported fields
}
Define the AssertHandler to encapsulate state
func (*AssertHandler) AddAssertData ¶
func (a *AssertHandler) AddAssertData(key string, value AssertData)
func (*AssertHandler) AddAssertFlush ¶
func (a *AssertHandler) AddAssertFlush(flusher AssertFlush)
func (*AssertHandler) AssertWithTimeout ¶
func (*AssertHandler) Never ¶
func (a *AssertHandler) Never(ctx context.Context, msg string, data ...any)
func (*AssertHandler) ProcessDeferredAssertions ¶
func (a *AssertHandler) ProcessDeferredAssertions(ctx context.Context)
Process all deferred assertions at once, logging or exiting if needed
func (*AssertHandler) RemoveAssertData ¶
func (a *AssertHandler) RemoveAssertData(key string)
func (*AssertHandler) SetDeferAssertions ¶
func (a *AssertHandler) SetDeferAssertions(deferMode bool)
SetDeferAssertions allows toggling deferred assertion mode
func (*AssertHandler) SetExitFunc ¶
func (a *AssertHandler) SetExitFunc(exitFunc func(int))
func (*AssertHandler) SetFormatter ¶
func (a *AssertHandler) SetFormatter(formatter Formatter)
func (*AssertHandler) ToWriter ¶
func (a *AssertHandler) ToWriter(w io.Writer)
type TextFormatter ¶
type TextFormatter struct{}
TextFormatter is the default plain text output format
Click to show internal directories.
Click to hide internal directories.