test

package
v0.0.0-...-9a46783 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2019 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(t *testing.T, srcPath, dstPath string)

CopyFile copies a file

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

func PrettyPrintWithDepth(v interface{}, depth int) string

PrettyPrintWithDepth tries to display a human readable version of an interface and allows to define the depth of the print

func ShouldPanic

func ShouldPanic(t *testing.T, fn func())

ShouldPanic will test is a function is panicking

func ShouldPanicWith

func ShouldPanicWith(t *testing.T, msg interface{}, fn func())

ShouldPanicWith will test is a function is panicking with a specific message

func TempDir

func TempDir(t *testing.T, dirName string) string

TempDir creates a temporary directory under the default directory for temporary files (see os.TempDir) and returns the path of the new directory or fails the test trying.

Types

This section is empty.

Jump to

Keyboard shortcuts

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