cmdtesting

package
v0.0.0-...-59bcbff Latest Latest
Warning

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

Go to latest
Published: May 13, 2016 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context

func Context(c *gc.C) *cmd.Context

Context creates a simple command execution context with the current dir set to a newly created directory within the test directory.

func ContextForDir

func ContextForDir(c *gc.C, dir string) *cmd.Context

ContextForDir creates a simple command execution context with the current dir set to the specified directory.

func InitCommand

func InitCommand(c cmd.Command, args []string) error

InitCommand will create a new flag set, and call the Command's SetFlags and Init methods with the appropriate args.

func NewFlagSet

func NewFlagSet() *gnuflag.FlagSet

NewFlagSet creates a new flag set using the standard options, particularly the option to stop the gnuflag methods from writing to StdErr or StdOut.

func RunCommand

func RunCommand(c *gc.C, com cmd.Command, args ...string) (*cmd.Context, error)

RunCommand runs a command with the specified args. The returned error may come from either the parsing of the args, the command initialisation, or the actual running of the command. Access to the resulting output streams is provided through the returned context instance.

func RunCommandInDir

func RunCommandInDir(c *gc.C, com cmd.Command, args []string, dir string) (*cmd.Context, error)

RunCommandInDir works like RunCommand, but runs with a context that uses dir.

func Stderr

func Stderr(ctx *cmd.Context) string

Stderr takes a command Context that we assume has been created in this package, and gets the content of the Stderr buffer as a string.

func Stdout

func Stdout(ctx *cmd.Context) string

Stdout takes a command Context that we assume has been created in this package, and gets the content of the Stdout buffer as a string.

func TestInit

func TestInit(c *gc.C, com cmd.Command, args []string, errPat string)

TestInit checks that a command initialises correctly with the given set of arguments.

Types

This section is empty.

Jump to

Keyboard shortcuts

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