internal

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrCanNotRunIfNotBuiltinTesting = "This test is only supported on types of *testing.T"
)

Variables

View Source
var DiffContextLines = 2
View Source
var Highlight = pterm.NewStyle(pterm.FgLightRed).Sprint
View Source
var LineNumbersEnabled = true

LineNumbersEnabled controls if line numbers should be printed in the fail printer.

Functions

func AssertCompareHelper added in v0.2.8

func AssertCompareHelper(t testRunner, object interface{}, option int, msg ...interface{})

AssertCompareHelper option: 1 = increasing, 0 = equal, -1 = decreasing

func AssertDirEmptyHelper added in v0.2.10

func AssertDirEmptyHelper(t testRunner, dir string) bool

AssertDirEmptyHelper checks for io.EOF to determine if directory empty or not

func AssertRegexpHelper added in v0.2.8

func AssertRegexpHelper(t testRunner, regex interface{}, txt interface{}, shouldMatch bool, msg ...interface{})

func CompareTwoValuesInASlice added in v0.2.8

func CompareTwoValuesInASlice(a reflect.Value, compareFunc func(a, b reflect.Value) bool) (ret bool)

CompareTwoValuesInASlice is a helper function.

func CompletesIn added in v0.2.9

func CompletesIn(duration time.Duration, f func()) bool

CompletesIn returns if a function completes in a specific time.

func DoesContain added in v0.2.9

func DoesContain(object, element interface{}) bool

DoesContain checks that ab objects contains an element.

func DoesImplement added in v0.2.9

func DoesImplement(interfaceObject, object interface{}) bool

DoesImplement checks if an objects implements an interface.

func Fail

func Fail(t testRunner, message string, objects Objects, args ...interface{})

func FailS

func FailS(message string, objects Objects, args ...interface{}) string

func GetCurrentScriptDirectory added in v0.2.2

func GetCurrentScriptDirectory() string

GetCurrentScriptDirectory returns the directory of the current Go file.

func GetDifference

func GetDifference(a, b interface{}, raw ...bool) string

GetDifference returns the diff for two projects.

func GetTest

func GetTest(t testRunner) *testing.T

GetTest converts to *testing.T.

func HasEqualValues added in v0.2.9

func HasEqualValues(expected interface{}, actual interface{}) bool

HasEqualValues checks if two objects have equal values.

func HasSameElements added in v0.2.13

func HasSameElements(expected interface{}, actual interface{}) bool

func IsEqual added in v0.2.9

func IsEqual(expected interface{}, actual interface{}) bool

IsEqual checks if two objects are equal.

func IsKind added in v0.2.9

func IsKind(expectedKind reflect.Kind, value interface{}) bool

IsKind returns if an object is kind of a specific kind.

func IsList added in v0.2.13

func IsList(list interface{}) bool

func IsNil added in v0.2.9

func IsNil(object interface{}) bool

IsNil checks if an object is nil.

func IsNumber added in v0.2.9

func IsNumber(value interface{}) bool

IsNumber checks if the value is of a numeric kind.

func IsSubset added in v0.2.14

func IsSubset(t testRunner, list interface{}, subset interface{}) bool

func IsZero added in v0.2.9

func IsZero(value interface{}) bool

IsZero checks if a value is the zero value of its type.

func ModifyWrappedText

func ModifyWrappedText(text, wrappingString string, modifier func(wrappedText string) string) string

Types

type Object

type Object struct {
	Name      string
	NameStyle *pterm.Style
	Data      interface{}
	DataStyle *pterm.Style
	Raw       bool
}

func NewDiffObject added in v0.3.2

func NewDiffObject(expected, actual interface{}, raw ...bool) Object

type Objects

type Objects []Object

func NewObjectsExpectedActual

func NewObjectsExpectedActual(expected, actual interface{}) Objects

func NewObjectsExpectedActualWithDiff added in v0.3.2

func NewObjectsExpectedActualWithDiff(expected, actual interface{}) Objects

func NewObjectsSingleNamed

func NewObjectsSingleNamed(name string, obj interface{}) Objects

func NewObjectsSingleUnknown

func NewObjectsSingleUnknown(obj interface{}) Objects

func NewObjectsUnknown

func NewObjectsUnknown(objs ...interface{}) Objects

Jump to

Keyboard shortcuts

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