behaviours

package
v0.2.1-beta Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//X is a special argument that is replaced with the actual value being tested
	X specialArgument = x{}

	//F is a special argument that is replaced with the path of the field being tested
	//Use this for formatting your error message
	F specialArgument = f{}
)

Functions

This section is empty.

Types

type ExpectedSlice

type ExpectedSlice []ExpectedStruct

ExpectedSlice Assert/Require a slice. The values are the behaviours we expect for each element

func (ExpectedSlice) CheckField

func (e ExpectedSlice) CheckField(t assert.TestingT, actualValueInterface interface{}, parentFieldName string) bool

CheckField Assert that a value slice matches the expected slice

type ExpectedStruct

type ExpectedStruct map[string]interface{}

ExpectedStruct Assert/Require a struct. The values are the behaviours we expect for each element

func (ExpectedStruct) CheckField

func (e ExpectedStruct) CheckField(t assert.TestingT, actualValueInterface interface{}, parentFieldName string) bool

CheckField Assert that a value struct matches the expected slice

type FieldBehaviour

type FieldBehaviour interface {
	CheckField(t assert.TestingT, actualValueInterface interface{}, parentFieldName string) bool
}

FieldBehaviour The interface to implement in order to have new behaviours

func Func

func Func(function interface{}, args ...interface{}) FieldBehaviour

Func is a factory that returns a new behaviour from a testify assert function

type IgnoredField

type IgnoredField struct {
}

IgnoredField Ignore this value

func (IgnoredField) CheckField

func (i IgnoredField) CheckField(_ assert.TestingT, _ interface{}, _ string) bool

CheckField Never returns an error

type NotEmptyField

type NotEmptyField struct {
}

NotEmptyField Assert/Require a non empty value

func (NotEmptyField) CheckField

func (n NotEmptyField) CheckField(t assert.TestingT, actualValueInterface interface{}, fieldName string) bool

CheckField Do the non empty assertion on a value

type SameValueField

type SameValueField struct {
	Expected interface{}
}

SameValueField Assert/Require that the value is the same, even if the type differs

func (SameValueField) CheckField

func (s SameValueField) CheckField(t assert.TestingT, actualValueInterface interface{}, fieldName string) bool

CheckField Performs the assertion of same value

type ZeroValueField

type ZeroValueField struct {
}

ZeroValueField Checks that the field value is the zero value for it's type

func (ZeroValueField) CheckField

func (z ZeroValueField) CheckField(t assert.TestingT, actualValueInterface interface{}, fieldName string) bool

CheckField Performs the assertion of zero value

Jump to

Keyboard shortcuts

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