builtin

package
v1.5.16-0...-543da53 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Assertions = map[string]func(t assert.TestingT, actual interface{}, expected interface{}, msgAndArgs ...interface{}) bool{
	"eq":                assert.EqualValues,
	"equals":            assert.EqualValues,
	"equal":             assert.EqualValues,
	"lt":                assert.Less,
	"less_than":         assert.Less,
	"le":                assert.LessOrEqual,
	"less_or_equals":    assert.LessOrEqual,
	"gt":                assert.Greater,
	"greater_than":      assert.Greater,
	"ge":                assert.GreaterOrEqual,
	"greater_or_equals": assert.GreaterOrEqual,
	"ne":                assert.NotEqual,
	"not_equal":         assert.NotEqual,
	"contains":          assert.Contains,
	"type_match":        assert.IsType,

	"startswith":               StartsWith,
	"endswith":                 EndsWith,
	"len_eq":                   EqualLength,
	"length_equals":            EqualLength,
	"length_equal":             EqualLength,
	"len_lt":                   LessThanLength,
	"count_lt":                 LessThanLength,
	"length_less_than":         LessThanLength,
	"len_le":                   LessOrEqualsLength,
	"count_le":                 LessOrEqualsLength,
	"length_less_or_equals":    LessOrEqualsLength,
	"len_gt":                   GreaterThanLength,
	"count_gt":                 GreaterThanLength,
	"length_greater_than":      GreaterThanLength,
	"len_ge":                   GreaterOrEqualsLength,
	"count_ge":                 GreaterOrEqualsLength,
	"length_greater_or_equals": GreaterOrEqualsLength,
	"contained_by":             ContainedBy,
	"str_eq":                   StringEqual,
	"string_equals":            StringEqual,
	"regex_match":              RegexMatch,
}
View Source
var ErrUnsupportedFileExt = fmt.Errorf("unsupported file extension")
View Source
var Functions = map[string]interface{}{
	"get_timestamp":     getTimestamp,
	"sleep":             sleep,
	"gen_random_string": genRandomString,
	"max":               math.Max,
	"md5":               MD5,
	"parameterize":      loadFromCSV,
	"P":                 loadFromCSV,
}

Functions

func ContainedBy

func ContainedBy(t assert.TestingT, actual, expected interface{}, msgAndArgs ...interface{}) bool

ContainedBy assert whether actual element contains expected element

func Contains

func Contains(s []string, e string) bool

func CreateFile

func CreateFile(filePath string, data string) error

func CreateFolder

func CreateFolder(folderPath string) error

func Dump2JSON

func Dump2JSON(data interface{}, path string) error

func Dump2YAML

func Dump2YAML(data interface{}, path string) error

func EndsWith

func EndsWith(t assert.TestingT, actual, expected interface{}, msgAndArgs ...interface{}) bool

EndsWith check if string ends with substring

func EnsureFolderExists

func EnsureFolderExists(folderPath string) error

func EqualLength

func EqualLength(t assert.TestingT, actual, expected interface{}, msgAndArgs ...interface{}) bool

func ExecCommand

func ExecCommand(cmd *exec.Cmd, cwd string) error

func FormatResponse

func FormatResponse(raw interface{}) interface{}

func GetRandomNumber

func GetRandomNumber(min, max int) int

func GreaterOrEqualsLength

func GreaterOrEqualsLength(t assert.TestingT, actual, expected interface{}, msgAndArgs ...interface{}) bool

func GreaterThanLength

func GreaterThanLength(t assert.TestingT, actual, expected interface{}, msgAndArgs ...interface{}) bool

func Interface2Float64

func Interface2Float64(i interface{}) (float64, error)

func InterfaceType

func InterfaceType(raw interface{}) string

func IsFilePathExists

func IsFilePathExists(path string) bool

IsFilePathExists returns true if path exists and path is file

func IsFolderPathExists

func IsFolderPathExists(path string) bool

IsFolderPathExists returns true if path exists and path is folder

func IsPathExists

func IsPathExists(path string) bool

IsPathExists returns true if path exists, whether path is file or dir

func LessOrEqualsLength

func LessOrEqualsLength(t assert.TestingT, actual, expected interface{}, msgAndArgs ...interface{}) bool

func LessThanLength

func LessThanLength(t assert.TestingT, actual, expected interface{}, msgAndArgs ...interface{}) bool

func LoadFile

func LoadFile(path string, structObj interface{}) (err error)

LoadFile loads file content with file extension and assigns to structObj

func MD5

func MD5(str string) string

func RegexMatch

func RegexMatch(t assert.TestingT, actual, expected interface{}, msgAndArgs ...interface{}) bool

func StartsWith

func StartsWith(t assert.TestingT, actual, expected interface{}, msgAndArgs ...interface{}) bool

StartsWith check if string starts with substring

func StringEqual

func StringEqual(t assert.TestingT, actual, expected interface{}, msgAndArgs ...interface{}) bool

func TypeNormalization

func TypeNormalization(raw interface{}) interface{}

Types

This section is empty.

Jump to

Keyboard shortcuts

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