Skip to content

Commit

Permalink
rename NewForTesting to NewApplication
Browse files Browse the repository at this point in the history
This will be more readable when called as cliotestutils.NewApplication.

Signed-off-by: Will Murphy <[email protected]>
  • Loading branch information
willmurphyscode committed Jan 29, 2024
1 parent 96ca556 commit aec76c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cliotestutils/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
"github.com/anchore/clio"
)

// NewForTesting takes a testing.T, a clio setup config, and a slice of assertions, and returns
// 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.
func NewForTesting(t *testing.T, cfg *clio.SetupConfig, assertions ...AssertionFunc) clio.Application {
func NewApplication(t *testing.T, cfg *clio.SetupConfig, assertions ...AssertionFunc) clio.Application {
cfg.Initializers = nil
a := clio.New(*cfg)

Expand Down

0 comments on commit aec76c1

Please sign in to comment.