internal

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

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

Variables

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

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

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

func AssertDirEmptyHelper

func AssertDirEmptyHelper(t testRunner, dir string) bool

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

func AssertRegexpHelper

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

func CompareTwoValuesInASlice

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

CompareTwoValuesInASlice is a helper function.

func CompletesIn

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

CompletesIn returns if a function completes in a specific time.

func DoesContain

func DoesContain(object, element interface{}) bool

DoesContain checks that ab objects contains an element.

func DoesImplement

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

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

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

HasEqualValues checks if two objects have equal values.

func IsEqual

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

IsEqual checks if two objects are equal.

func IsKind

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

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

func IsNil

func IsNil(object interface{}) bool

IsNil checks if an object is nil.

func IsNumber

func IsNumber(value interface{}) bool

IsNumber checks if the value is of a numeric kind.

func IsZero

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
}

type Objects

type Objects []Object

func NewObjectsExpectedActual

func NewObjectsExpectedActual(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