testutil

package
v0.0.0-...-677ed08 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2016 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Contains check.Checker = &containsChecker{
	&check.CheckerInfo{Name: "Contains", Params: []string{"container", "elem"}},
}

Contains is a Checker that looks for a elem in a container. The elem can be any object. The container can be an array, slice or string.

View Source
var DeepContains check.Checker = &deepContainsChecker{
	&check.CheckerInfo{Name: "DeepContains", Params: []string{"container", "elem"}},
}

DeepContains is a Checker that looks for a elem in a container using DeepEqual. The elem can be any object. The container can be an array, slice or string.

Functions

This section is empty.

Types

type BaseTest

type BaseTest struct {
	// contains filtered or unexported fields
}

BaseTest is a structure used as a base test suite for all the snappy tests.

func (*BaseTest) AddCleanup

func (s *BaseTest) AddCleanup(f func())

AddCleanup adds a new cleanup function to the test

func (*BaseTest) SetUpTest

func (s *BaseTest) SetUpTest(c *check.C)

SetUpTest prepares the cleanup

func (*BaseTest) TearDownTest

func (s *BaseTest) TearDownTest(c *check.C)

TearDownTest cleans up the channel.ini files in case they were changed by the test. It also runs the cleanup handlers

type MockCmd

type MockCmd struct {
	// contains filtered or unexported fields
}

MockCmd allows mocking commands for testing.

func MockCommand

func MockCommand(c *check.C, basename, script string) *MockCmd

MockCommand adds a mocked command to PATH.

The command logs all invocations to a dedicated log file. If script is non-empty then it is used as is and the caller is responsible for how the script behaves (exit code and any extra behavior). If script is empty then the command exits successfully without any other side-effect.

func (*MockCmd) Also

func (cmd *MockCmd) Also(basename, script string) *MockCmd

Also mock this command, using the same bindir and log Useful when you want to check the ordering of things.

func (*MockCmd) BinDir

func (cmd *MockCmd) BinDir() string

BinDir returns the location of the directory holding overridden commands.

func (*MockCmd) Calls

func (cmd *MockCmd) Calls() [][]string

Calls returns a list of calls that were made to the mock command. of the form:

[][]string{
    {"cmd", "arg1", "arg2"}, // first invocation of "cmd"
    {"cmd", "arg1", "arg2"}, // second invocation of "cmd"
}

func (*MockCmd) ForgetCalls

func (cmd *MockCmd) ForgetCalls()

ForgetCalls purges the list of calls made so far

func (*MockCmd) Restore

func (cmd *MockCmd) Restore()

Restore removes the mocked command from PATH

Jump to

Keyboard shortcuts

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