toolkit

package
v0.0.0-...-1185c8f Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithT

func ContextWithT(ctx context.Context, t testing.TB) context.Context

func Filter

func Filter[ElementType any](ss []ElementType, test func(ElementType) bool) (ret []ElementType)

func Log

func Log(ctx context.Context, args ...any)

func LogDuration

func LogDuration(ctx context.Context, duration time.Duration, warningDuration time.Duration, message string)

func LogStep

func LogStep(t testing.TB, msg string) func()

LogStep logs "→ msg..." at the start and "✓ msg done (Xs)" or "✗ msg failed (Xs)" when the returned function is called. Intended for use with defer:

defer toolkit.LogStep(t, "creating firewall")()

func LogStepCtx

func LogStepCtx(ctx context.Context, msg string) func()

LogStepCtx is like LogStep but extracts testing.TB from context.

func LogStepCtxf

func LogStepCtxf(ctx context.Context, format string, args ...any) func()

LogStepCtxf is like LogStepCtx but accepts a format string.

func LogStepf

func LogStepf(t testing.TB, format string, args ...any) func()

LogStepf is like LogStep but accepts a format string.

func Logf

func Logf(ctx context.Context, format string, args ...any)

func Map

func Map[OriginalElementType, TransformedElementType any](ts []OriginalElementType, f func(OriginalElementType) TransformedElementType) []TransformedElementType

func Reduce

func Reduce[ElementType, ReturnType any](s []ElementType, initialValue ReturnType, f func(sum ReturnType, next ElementType) ReturnType) ReturnType

func StrToInt32

func StrToInt32(s string) int32

func WithTestLogger

func WithTestLogger(t testing.TB) testing.TB

Types

This section is empty.

Jump to

Keyboard shortcuts

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