Documentation ¶
Index ¶
- func CopyFile(t *testing.T, srcPath, dstPath string)
- func DeepEqual(a, b interface{}) bool
- func Diff(expected, actual interface{}) string
- func PrettyPrint(v interface{}) string
- func PrettyPrintWithDepth(v interface{}, depth int) string
- func ShouldPanic(t *testing.T, fn func())
- func ShouldPanicWith(t *testing.T, msg interface{}, fn func())
- func ShouldPanicWithStr(t *testing.T, msg string, fn func())
- func TempDir(t *testing.T, dirName string) string
- type DeepEqualer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeepEqual ¶
func DeepEqual(a, b interface{}) bool
DeepEqual is a faster implementation of reflect.DeepEqual that:
- Has a reflection-free fast-path for all the common types we use.
- Gives data types the ability to exclude some of their fields from the consideration of DeepEqual by tagging them with `deepequal:"ignore"`.
- Gives data types the ability to define their own comparison method by implementing the comparable interface.
- Supports "composite" (or "complex") keys in maps that are pointers.
func Diff ¶
func Diff(expected, actual interface{}) string
Diff returns the difference of two objects in a human readable format. An empty string is returned when there is no difference. To avoid confusing diffs, make sure you pass the expected value first.
func PrettyPrint ¶
func PrettyPrint(v interface{}) string
PrettyPrint tries to display a human readable version of an interface
func PrettyPrintWithDepth ¶
PrettyPrintWithDepth tries to display a human readable version of an interface and allows to define the depth of the print
func ShouldPanic ¶
ShouldPanic will test is a function is panicking
func ShouldPanicWith ¶
ShouldPanicWith will test is a function is panicking with a specific message
func ShouldPanicWithStr ¶
ShouldPanicWithStr a function panics with a specific string. If the function panics with an error, the error's message is compared to the string.
Types ¶
type DeepEqualer ¶
type DeepEqualer interface {
DeepEqual(other interface{}, comparer func(a, b interface{}) bool) bool
}
DeepEqualer allows collection types to compare their values using a given comparator.