test

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package test provides useful test helpers that can be used in multiple packages.

Index

Constants

This section is empty.

Variables

View Source
var DefaultTime = time.Date(2023, 9, 29, 13, 0, 59, 0, time.UTC)

DefaultTime is a single point in time to use for log lines

Functions

This section is empty.

Types

type Handler

type Handler struct {
	Records []slog.Record
	Ctxs    []context.Context
	Source  bool
	// contains filtered or unexported fields
}

Handler is a slog.Handler that records the records that come its way

func (*Handler) Clear added in v0.8.0

func (h *Handler) Clear()

Clear deletes all existing records and contexts

func (*Handler) Enabled

func (h *Handler) Enabled(_ context.Context, lvl slog.Level) bool

Enabled returns true

func (*Handler) Handle

func (h *Handler) Handle(ctx context.Context, r slog.Record) error

Handle records a log record

func (*Handler) MarshalJSON

func (h *Handler) MarshalJSON() ([]byte, error)

MarshalJSON formats all log records with slog.JSONHandler

func (*Handler) String

func (h *Handler) String() string

String formats all log records with slog.TextHandler

func (*Handler) WithAttrs

func (h *Handler) WithAttrs([]slog.Attr) slog.Handler

WithAttrs panics

func (*Handler) WithGroup

func (h *Handler) WithGroup(string) slog.Handler

WithGroup panics

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL