Documentation
¶
Index ¶
- func Args(args ...interface{}) interface{}
- func BoolP(b bool) *bool
- func CaptureLog() *capture
- func CaptureStdErr() *capture
- func CaptureStdOut() *capture
- func CmpFuncs(x, y interface{}) (b bool, s string)
- func Contains(x, y interface{}) (bool, string)
- func ContainsFn(x, y interface{}) (bool, string)
- func Equal(actual, expected interface{}) (bool, string)
- func ErrType(err error) error
- func Float32P(f float32) *float32
- func Float64P(f float64) *float64
- func Int16P(i int16) *int16
- func Int32P(i int32) *int32
- func Int64P(i int64) *int64
- func Int8P(i int8) *int8
- func IntP(i int) *int
- func StringP(s string) *string
- func Time(layout, value string) time.Time
- func TimeDay(value string) time.Time
- func TimeHour(value string) time.Time
- func TimeP(layout, value string) *time.Time
- func Times(layout string, values ...string) []time.Time
- func Uint16P(i uint16) *uint16
- func Uint32P(i uint32) *uint32
- func Uint64P(i uint64) *uint64
- func Uint8P(i uint8) *uint8
- func UintP(i uint) *uint
- type Case
- type Cases
- type CompareFunc
- type Comparer
- type TestFunc
- type Trial
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Args ¶
func Args(args ...interface{}) interface{}
Args converts any number of parameters to an interface. generally used with Case's Input for multiple params
func CaptureLog ¶ added in v0.1.1
func CaptureLog() *capture
CaptureLog overrides the log output for reading
func CaptureStdErr ¶ added in v0.1.1
func CaptureStdErr() *capture
CaptureStdErr redirects stderr for reading note this does not redirect log output
func CaptureStdOut ¶ added in v0.1.1
func CaptureStdOut() *capture
CaptureStdOut redirects stdout for reading
func Contains ¶ added in v0.1.1
Contains determines if y is a subset of x. x is a string -> y is a string that is equal to or a subset of x (string.Contains) x is a slice or array -> y is contained in x x is a map -> y is a map and is contained in x
func ContainsFn ¶
ContainsFn has been renamed to Contains Deprecated:
func Equal ¶
Equal use the cmp.Diff method to check equality and display differences. This method checks all unexpected values
func ErrType ¶
ErrType can be used with ExpectedErr to check that the expected err is of a certain type
func Time ¶
Time is a panic wrapper for the time.Parse method it returns a time.Time for the given layout and value
func TimeHour ¶
TimeHour is a helper method for parsing times with hour precision. format 2006-01-02T15
func TimeP ¶
TimeP return a pointers to a time.Time for the given layout and value. it panics on error
func Times ¶
Times is a panic wrapper for the time.Parse method it returns a time.Time slice for the given layout and values
Types ¶
type Case ¶
type Case struct { Input interface{} Expected interface{} // testing conditions ShouldErr bool // is an error expected ExpectedErr error // the error that was expected (nil is no error expected) ShouldPanic bool // is a panic expected }
Case made during the trial of your code
type CompareFunc ¶ added in v0.2.1
CompareFunc compares actual and expected to determine equality. It should return a human readable string representing the differences between actual and expected. Symbols with meaning: "-" elements missing from actual "+" elements missing from expected
type Comparer ¶ added in v0.2.1
Comparer interface is implemented by an object to check for equality and show any differences found
type TestFunc ¶
type TestFunc func(args ...interface{}) (result interface{}, err error)
TestFunc a wrapper function used to setup the method being tested.
type Trial ¶
type Trial struct {
// contains filtered or unexported fields
}
Trial framework used to test different logical states
func (*Trial) Comparer ¶ added in v0.2.1
func (t *Trial) Comparer(fn CompareFunc) *Trial
Comparer override the default comparison function. see Contains(x, y interface{}) (bool, string) see Equals(x, y interface{}) (bool, string)
func (*Trial) EqualFn ¶
func (t *Trial) EqualFn(fn CompareFunc) *Trial
EqualFn override the default comparison method used. see ContainsFn(x, y interface{}) (bool, string) depricated