cliotestutils

package
v0.0.0-...-3c4abf8 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 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 *clio.SetupConfig, assertions ...AssertionFunc) clio.Application

NewApplication takes a testing.T, a clio setup config, and a slice of assertions, and returns a clio 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 clio 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