in cmd/util/testutils/cmd.go [51:74]
func RunCmdAssertion(t *testing.T, args Args, assertion Assertion) {
cfg := fillDefaults(args.Cfg)
cfg.Out = new(bytes.Buffer)
cfg.Err = new(bytes.Buffer)
defer mockApp(t, cfg)()
// Set the command arguments.
args.Cmd.Root().SetArgs(args.Args)
// Necessary to reduce the clutter on the output
args.Cmd.SilenceUsage = true
args.Cmd.SilenceErrors = true
// Set the Out and Err to the mocked devices.
args.Cmd.SetOut(cfg.Out)
args.Cmd.SetErr(cfg.Err)
err := args.Cmd.Execute()
assertCmd(t, args, assertion, err,
strings.Contains(strings.Join(args.Args, " "), "--track"),
)
}