clitest
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Variables
- func CreateTemplateVersionSource(t *testing.T, responses *echo.Responses) string
- func HandlersOK(t *testing.T, cmd *clibase.Cmd)
- func New(t *testing.T, args ...string) (*clibase.Invocation, config.Root)
- func NewWithCommand(t *testing.T, cmd *clibase.Cmd, args ...string) (*clibase.Invocation, config.Root)
- func NormalizeGoldenFile(t *testing.T, byt []byte) []byte
- func Run(t *testing.T, inv *clibase.Invocation)
- func SetupConfig(t *testing.T, client *codersdk.Client, root config.Root)
- func Start(t *testing.T, inv *clibase.Invocation)
- func TestCommandHelp(t *testing.T, getRoot func(t *testing.T) *clibase.Cmd, cases []CommandHelpCase)
- type CommandHelpCase
- type ErrorWaiter
Constants¶
This section is empty.
Variables¶
var UpdateGoldenFiles =flag.Bool("update",false, "update .golden files")
UpdateGoldenFiles indicates golden files should be updated.To update the golden files:make update-golden-files
Functions¶
funcCreateTemplateVersionSource¶added inv0.4.0
CreateTemplateVersionSource writes the echo provisioner responses into anew temporary testing directory.
funcHandlersOK¶added inv0.25.0
HandlersOK asserts that all commands have a handler.Without a handler, the command has no default behavior. Even fornon-root commands (like 'groups' or 'users'), a handler is required.These handlers are likely just the 'help' handler, but this must beexplicitly set.
funcNewWithCommand¶added inv0.21.0
funcNormalizeGoldenFile¶added inv0.24.1
NormalizeGoldenFile replaces any strings that are system or timing dependentwith a placeholder so that the golden files can be compared with a simpleequality check.
funcRun¶added inv0.21.0
func Run(t *testing.T, inv *clibase.Invocation)
Run runs the command and asserts that there is no error.
funcSetupConfig¶
SetupConfig applies the URL and SessionToken of the client to the config.
funcStart¶added inv0.19.0
func Start(t *testing.T, inv *clibase.Invocation)
Start runs the command in a goroutine and cleans it up when the testcompleted.
funcTestCommandHelp¶added inv0.24.1
func TestCommandHelp(t *testing.T, getRoot func(t *testing.T) *clibase.Cmd, cases []CommandHelpCase)
TestCommandHelp will test the help output of the given commandsusing golden files.
Types¶
typeCommandHelpCase¶added inv0.24.1
funcDefaultCases¶added inv0.24.1
func DefaultCases() []CommandHelpCase
typeErrorWaiter¶added inv0.21.0
type ErrorWaiter struct {// contains filtered or unexported fields}
funcStartWithWaiter¶added inv0.21.0
func StartWithWaiter(t *testing.T, inv *clibase.Invocation) *ErrorWaiter
StartWithWaiter runs the command in a goroutine but returns the error insteadof asserting it. This is useful for testing error cases.
func (*ErrorWaiter)Cancel¶added inv0.23.5
func (w *ErrorWaiter) Cancel()
func (*ErrorWaiter)RequireAs¶added inv0.21.0
func (w *ErrorWaiter) RequireAs(want interface{})
func (*ErrorWaiter)RequireContains¶added inv0.21.0
func (w *ErrorWaiter) RequireContains(sstring)
func (*ErrorWaiter)RequireError¶added inv0.21.0
func (w *ErrorWaiter) RequireError()
func (*ErrorWaiter)RequireIs¶added inv0.21.0
func (w *ErrorWaiter) RequireIs(wanterror)
func (*ErrorWaiter)RequireSuccess¶added inv0.21.0
func (w *ErrorWaiter) RequireSuccess()
func (*ErrorWaiter)Wait¶added inv0.21.0
func (w *ErrorWaiter) Wait()error