Documentation ¶
Overview ¶
Package tt supports table-driven tests with little boilerplate.
See the test case for this package for example usage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Case ¶
type Case struct {
// contains filtered or unexported fields
}
Case represents a test case. It is created by the C function, and offers setters that augment and return itself; those calls can be chained like C(...).Rets(...).
func (*Case) Rets ¶
Rets modifies the test case so that it requires the return values to match the given values. It returns the receiver. The arguments may implement the Matcher interface, in which case its Match method is called with the actual return value. Otherwise, reflect.DeepEqual is used to determine matches.
type FnToTest ¶
type FnToTest struct {
// contains filtered or unexported fields
}
FnToTest describes a function to test.
type Matcher ¶
type Matcher interface { // Match reports whether a return value is considered a match. The argument // is of type RetValue so that it cannot be implemented accidentally. Match(RetValue) bool }
Matcher wraps the Match method.
type RetValue ¶
type RetValue interface{}
RetValue is an empty interface used in the Matcher interface.