gobtestutils

package
v0.0.0-...-8d08c58 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewApplication

func NewApplication(t *testing.T, cfg *gob.SetupConfig, assertions ...AssertionFunc) gob.Application

NewApplication takes a testing.T, a gob setup config, and a slice of assertions, and returns a gob application that will, instead of setting up commands with their normal RunE, set up commands such that the assertions are called with the testing.T after config state is set up by reading flags, env vars, and config files. Useful for testing that expected configuration options are wired up. Note that initializers will be cleared from the gob setup config, since the initialization may happen more than once and affect global state. For necessary global state, a workaround is to set it in a TestingMain.

Types

type AssertionFunc

type AssertionFunc func(t *testing.T, cmd *cobra.Command, args []string, cfgs ...any)

func OptionsEquals

func OptionsEquals(wantOpts any) AssertionFunc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳