Documentation
¶
Index ¶
- func Check(t *testing.T, err error)
- func CheckTime(t *testing.T, got, want time.Time)
- func Checker(t *testing.T) (check func(err error))
- func LogWriter(t *testing.T) io.Writer
- func SlogBuffer() (lg *slog.Logger, out *bytes.Buffer)
- func Slogger(t *testing.T) *slog.Logger
- func StopPanic(f func())
- func WriteFile[S []byte | string](t testing.TB, name string, data S)
- type CheckFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckTime ¶
CheckTime calls t.Fatalf if got != want. Included in the error message is want.Sub(got) to help diagnose the difference, along with their values in UTC.
func SlogBuffer ¶
SlogBuffer returns a *slog.Logger that writes each message to out.
func Slogger ¶
Slogger returns a *slog.Logger that writes each message using t.Log.
func StopPanic ¶
func StopPanic(f func())
StopPanic runs f but silently recovers from any panic f causes. The normal usage is:
testutil.StopPanic(func() { callThatShouldPanic() t.Errorf("callThatShouldPanic did not panic") })
Types ¶
Click to show internal directories.
Click to hide internal directories.