assert

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package assert 重新封装assert函数,支持mysql、redis等校验 统一打印错误日志,用于报警显示

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(t *testing.T, exp, got interface{}, args ...interface{}) bool

func ContainsOf

func ContainsOf(t *testing.T, exp, got interface{}, args ...interface{}) bool

语义:实际结果包含配置value

func ElementsMatch

func ElementsMatch(t *testing.T, exp, got interface{}, args ...interface{}) bool

func Empty

func Empty(t *testing.T, got interface{}, args ...interface{}) bool

func Equal

func Equal(t *testing.T, exp, got interface{}, args ...interface{}) bool

func EqualJson

func EqualJson(t *testing.T, exp, got string) bool

func EqualJsonByte

func EqualJsonByte(t *testing.T, exp, got []byte) bool

func EqualJsonByteWithConsoleOutput

func EqualJsonByteWithConsoleOutput(t *testing.T, exp, got []byte) bool

func EqualJsonStrWithConsoleOutput

func EqualJsonStrWithConsoleOutput(t *testing.T, exp, got string) bool

func Error

func Error(t *testing.T, got error, args ...interface{}) bool

func False

func False(t *testing.T, got bool, args ...interface{}) bool

func GetLastTestCasePositionFromCallerStack

func GetLastTestCasePositionFromCallerStack() (string, string)

func Greater

func Greater(t *testing.T, exp interface{}, got interface{}, args ...interface{}) bool

func GreaterOrEqual

func GreaterOrEqual(t *testing.T, exp interface{}, got interface{}, args ...interface{}) bool

func HandleJsonNumber

func HandleJsonNumber(data interface{}) (res interface{})

func IsExist

func IsExist(t *testing.T, exp string, got map[string]interface{}, args ...interface{}) bool

func JsonValidate

func JsonValidate(t *testing.T, scheam string, v interface{})

func JsonValidateFromFile

func JsonValidateFromFile(t *testing.T, scheamFilePath string, v interface{}, args ...interface{}) bool

func Less

func Less(t *testing.T, exp interface{}, got interface{}, args ...interface{}) bool

func LessOrEqual

func LessOrEqual(t *testing.T, exp interface{}, got interface{}, args ...interface{}) bool

func Nil

func Nil(t *testing.T, got interface{}, args ...interface{}) bool

func NoError

func NoError(t *testing.T, got error, args ...interface{}) bool

func NotEmpty

func NotEmpty(t *testing.T, got interface{}, args ...interface{}) bool

func NotEqual

func NotEqual(t *testing.T, exp, got interface{}, args ...interface{}) bool

func NotNil

func NotNil(t *testing.T, got interface{}, args ...interface{}) bool

func True

func True(t *testing.T, got bool, args ...interface{}) bool

Types

type Expect

type Expect struct {
	Method     string      `json:"method"`
	Value      interface{} `json:"value"`
	Key        string      `json:"key"`
	SchemaPath string      `json:"schema_path"`
}

func (*Expect) Assert

func (exp *Expect) Assert(t *testing.T, got interface{}, args ...interface{}) bool

func (*Expect) AssertKey

func (exp *Expect) AssertKey(t *testing.T) string

func (*Expect) AssertObjFields

func (exp *Expect) AssertObjFields(t *testing.T, result interface{}, args ...interface{}) bool

func (*Expect) DetermineGot

func (exp *Expect) DetermineGot(got interface{}) (string, interface{})

func (*Expect) InInterval

func (exp *Expect) InInterval(t *testing.T, result interface{}, args ...interface{}) bool

type ExpectMultiMethod

type ExpectMultiMethod func(t *testing.T, exp, got interface{}, msg ...interface{}) bool

type ExpectSingleMethod

type ExpectSingleMethod func(t *testing.T, got interface{}, msg ...interface{}) bool

type Interval

type Interval struct {
	Left  *IntervalConf `json:"left"`
	Right *IntervalConf `json:"right"`
}

type IntervalConf

type IntervalConf struct {
	Value float64 `json:"val"`
	Rule  string  `json:"rule"`
}

type IntervalRule

type IntervalRule string
const (
	OpenInterval   IntervalRule = "open"
	ClosedInterval IntervalRule = "closed"
)

Jump to

Keyboard shortcuts

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