internal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DiffContextLines = 2
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 any, option int, msg ...any)

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 any, txt any, shouldMatch bool, msg ...any)

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 any) bool

DoesContain checks that ab objects contains an element.

func Fail

func Fail(t testRunner, message string, objects Objects, args ...any)

func FailS

func FailS(message string, objects Objects, args ...any) string

func GetCurrentScriptDirectory

func GetCurrentScriptDirectory() string

GetCurrentScriptDirectory returns the directory of the current Go file.

func GetTest

func GetTest(t testRunner) *testing.T

GetTest converts to *testing.T.

func HasEqualValues

func HasEqualValues(expected any, actual any) bool

HasEqualValues checks if two objects have equal values.

func HasSameElements

func HasSameElements[T comparable](expected []T, actual []T) bool

func IsEqual

func IsEqual(expected any, actual any) bool

IsEqual checks if two objects are equal.

func IsSubset

func IsSubset[T comparable](t testRunner, list []T, subset []T) bool

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      any
	DataStyle *pterm.Style
	Raw       bool
}

func NewDiffObject

func NewDiffObject(expected, actual any, raw ...bool) Object

type Objects

type Objects []Object

func NewObjectsExpectedActual

func NewObjectsExpectedActual(expected, actual any) Objects

func NewObjectsExpectedActualWithDiff

func NewObjectsExpectedActualWithDiff(expected, actual any) Objects

func NewObjectsSingleNamed

func NewObjectsSingleNamed(name string, obj any) Objects

func NewObjectsSingleUnknown

func NewObjectsSingleUnknown(obj any) Objects

func NewObjectsUnknown

func NewObjectsUnknown(objs ...any) Objects

Jump to

Keyboard shortcuts

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