testhelpers

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringOrDie

func StringOrDie(t testing.TB, in any) string

StringOrDie renders its input using ToMap, and returns a string containing the result. If rendering yields an error, calls t.Fatal.

func ToMap

func ToMap(in any) (map[string]any, error)

ToMap renders an input value of any type as a map. This is intended for logging human-readable data dumps in test logs, so it uses the `json` tags on struct fields: this makes it easy to exclude `"-"` values that are typically not interesting, respect omitempty, etc.

We also replace any []byte fields with a hash of their value. This is usually sufficient for test log purposes, and is a lot more readable than a big array of individual byte values like Go would normally stringify a byte slice.

func ToString

func ToString(in any) string

ToString renders its input using ToMap, and returns a string containing the result or an error if that fails.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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