assert

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package assert holds dependency-free test assertion helpers usable from any package's tests. It deliberately imports no flate packages so that even internal (package X) tests of packages that internal/testutil depends on — manifest, store — can use it without an import cycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(tb testing.TB, got, want any)

Diff fails tb (non-fatally) with a structural diff when got != want. Uses go-cmp; intended for maps, slices, and structs with exported fields (cmp panics on unexported fields without options) — keep manual comparison for types with unexported state.

func Equal

func Equal[T comparable](tb testing.TB, got, want T)

Equal fails tb (non-fatally) when got != want, reporting both.

func ErrorIf added in v0.7.3

func ErrorIf(tb testing.TB, invalid bool, format string, args ...any)

ErrorIf fails the test when invalid is true.

func FatalIf added in v0.7.3

func FatalIf(tb testing.TB, invalid bool, format string, args ...any)

FatalIf stops the test when invalid is true.

func NoError added in v0.7.3

func NoError(tb testing.TB, err error)

NoError stops the test when an operation fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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