testutil

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckErrorStrings added in v1.6.0

func CheckErrorStrings(t TB, got []string, expected []string)

CheckErrorStrings verifies that the actual error strings match the expected error strings. Both slices are sorted before comparison to handle ordering differences. Strings are normalized to remove cosmetic paren differences between Go and Rust Cedar formatting.

func CollectErrors added in v1.6.0

func CollectErrors(err error) []string

CollectErrors recursively collects all leaf error strings from a (possibly joined) error.

func Equals

func Equals[T any](t TB, a, b T)

func Error

func Error(t TB, err error)

func ErrorIs

func ErrorIs(t TB, got, want error)

func FatalIf

func FatalIf(t TB, c bool, f string, args ...any)

func JSONMarshalsTo added in v1.0.0

func JSONMarshalsTo[T any](t TB, obj T, want string)

JSONMarshalsTo asserts that obj marshals as JSON to the given string, allowing for formatting differences and displaying an easy-to-read diff.

func Must added in v1.0.0

func Must[T any](t T, err error) T

func OK

func OK(t TB, err error)

func Panic

func Panic(t TB, f func())

Types

type TB

type TB interface {
	Helper()
	Errorf(format string, args ...any)
	Fatalf(format string, args ...any)
}

Jump to

Keyboard shortcuts

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