pt

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckTwirpErrorCode

func CheckTwirpErrorCode(t *testing.T, err error, code twirp.ErrorCode)

func DisableXRay

func DisableXRay()

func ExpectTwirpInvalidArgument

func ExpectTwirpInvalidArgument(t *testing.T, err error, argument string)

func Must

func Must(t *testing.T, err error, msg string)

func Mustf

func Mustf(t *testing.T, err error, format string, a ...interface{})

func NewTestLogWriter

func NewTestLogWriter(t *testing.T) io.Writer

func TestContext

func TestContext(t *testing.T) context.Context

Types

type TestEnv

type TestEnv struct {
	// contains filtered or unexported fields
}

TestEnv is a utility for setting and resetting environment variables for tests. An empty test env is ready for use and will acquire a lock on environment changes at the first environment change, and releases it when Cleanup() is called.

func (*TestEnv) Cleanup

func (te *TestEnv) Cleanup()

Cleanup restores the environment to its original state and releases the environment lock. Safe to call multiple times.

func (*TestEnv) Set

func (te *TestEnv) Set(name, value string)

Set a single environment variable. Acquires an environment lock when first called. Panics if called after Cleanup().

func (*TestEnv) SetAll

func (te *TestEnv) SetAll(vars map[string]string)

SetAll the provided environment variables. Acquires an environment lock when first called. Panics if called after Cleanup().

Jump to

Keyboard shortcuts

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