testutil

package
v0.55.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResetArgs

func ResetArgs(t *testing.T, cmd *cobra.Command)

ResetArgs resets arguments for the command. It is desired to be a helpful function for the cmd.SetArgs in the case of calling multiple times in a unit test, as cmd.SetArgs doesn't reset the flag value as expected.

**Warning**: this is only compatible with following flag types:

  1. the implementations of pflag.Value
  2. the built-in implementations of pflag.SliceValue
  3. the custom implementations of pflag.SliceValue that are split by comma ","

see https://github.com/spf13/cobra/issues/2079#issuecomment-1870115781 for more detail info

Types

type MockFlagsWithComma

type MockFlagsWithComma struct {
	Ary []string
	// contains filtered or unexported fields
}

func (*MockFlagsWithComma) Append

func (m *MockFlagsWithComma) Append(value string) error

func (*MockFlagsWithComma) GetSlice

func (m *MockFlagsWithComma) GetSlice() []string

func (*MockFlagsWithComma) Replace

func (m *MockFlagsWithComma) Replace(value []string) error

func (*MockFlagsWithComma) Set

func (m *MockFlagsWithComma) Set(value string) error

func (*MockFlagsWithComma) String

func (m *MockFlagsWithComma) String() string

func (*MockFlagsWithComma) Type

func (m *MockFlagsWithComma) Type() string

type MockFlagsWithSemicolon

type MockFlagsWithSemicolon struct {
	Ary []string
	// contains filtered or unexported fields
}

func (*MockFlagsWithSemicolon) Append

func (m *MockFlagsWithSemicolon) Append(value string) error

func (*MockFlagsWithSemicolon) GetSlice

func (m *MockFlagsWithSemicolon) GetSlice() []string

func (*MockFlagsWithSemicolon) Replace

func (m *MockFlagsWithSemicolon) Replace(value []string) error

func (*MockFlagsWithSemicolon) Set

func (m *MockFlagsWithSemicolon) Set(value string) error

func (*MockFlagsWithSemicolon) String

func (m *MockFlagsWithSemicolon) String() string

func (*MockFlagsWithSemicolon) Type

func (m *MockFlagsWithSemicolon) Type() string

Jump to

Keyboard shortcuts

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