unit

package
v0.0.0-...-71b9ecf Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrorf

func NewErrorf(format string, arguments ...interface{}) error

Types

type AndConstraint

type AndConstraint struct {
	// contains filtered or unexported fields
}

func (*AndConstraint) Check

func (c *AndConstraint) Check(value interface{}) bool

func (*AndConstraint) Details

func (c *AndConstraint) Details(value interface{}) string

func (*AndConstraint) String

func (c *AndConstraint) String() string

type AnyConstraint

type AnyConstraint struct {
}

func (*AnyConstraint) Check

func (c *AnyConstraint) Check(value interface{}) bool

func (*AnyConstraint) Details

func (c *AnyConstraint) Details(value interface{}) string

func (*AnyConstraint) String

func (c *AnyConstraint) String() string

type CallbackConstraint

type CallbackConstraint struct {
	// contains filtered or unexported fields
}

func (*CallbackConstraint) Check

func (c *CallbackConstraint) Check(value interface{}) bool

func (*CallbackConstraint) Details

func (c *CallbackConstraint) Details(value interface{}) string

func (*CallbackConstraint) String

func (c *CallbackConstraint) String() string

type Constraint

type Constraint interface {
	Check(value interface{}) bool
	String() string
	Details(value interface{}) string
}

func NewAndConstraint

func NewAndConstraint(constraints ...Constraint) Constraint

func NewAnyConstraint

func NewAnyConstraint() Constraint

func NewCallbackConstraint

func NewCallbackConstraint(callback func(value interface{}) bool) Constraint

func NewContainsConstraint

func NewContainsConstraint(element interface{}, options ...interface{}) Constraint

func NewElementsConstraint

func NewElementsConstraint(constraints ...Constraint) Constraint

func NewEmptyConstraint

func NewEmptyConstraint() Constraint

func NewEqualConstraint

func NewEqualConstraint(expected interface{}, comparator EqualComparer) Constraint

func NewFalseConstraint

func NewFalseConstraint() Constraint

func NewGreaterConstraint

func NewGreaterConstraint(expected interface{}) Constraint

func NewKindConstraint

func NewKindConstraint(expectedKinds ...reflect.Kind) Constraint

func NewLengthConstraint

func NewLengthConstraint(length int) Constraint

func NewLengthGreaterConstraint

func NewLengthGreaterConstraint(length int) Constraint

func NewLengthLessConstraint

func NewLengthLessConstraint(length int) Constraint

func NewLessConstraint

func NewLessConstraint(expected interface{}) Constraint

func NewNilConstraint

func NewNilConstraint() Constraint

func NewNotConstraint

func NewNotConstraint(constraint Constraint) Constraint

func NewOrConstraint

func NewOrConstraint(constraints ...Constraint) Constraint

func NewRegexpConstraint

func NewRegexpConstraint(pattern string) Constraint

func NewSameConstraint

func NewSameConstraint(value interface{}) Constraint

func NewTrueConstraint

func NewTrueConstraint() Constraint

func NewTypeConstraint

func NewTypeConstraint(expectedTypes ...interface{}) Constraint

func NewValueConstraint

func NewValueConstraint(expected interface{}, comparator EqualComparer) Constraint

func NewValueElementsConstraint

func NewValueElementsConstraint(comparator EqualComparer, values ...interface{}) Constraint

type ConstraintAsValue

type ConstraintAsValue struct {
	Value Constraint
}

type ContainsConstraint

type ContainsConstraint struct {
	// contains filtered or unexported fields
}

func (*ContainsConstraint) Check

func (c *ContainsConstraint) Check(list interface{}) bool

func (*ContainsConstraint) Details

func (c *ContainsConstraint) Details(list interface{}) string

func (*ContainsConstraint) String

func (c *ContainsConstraint) String() string

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(test TestingT) *Controller

func (*Controller) And

func (c *Controller) And(constraint ...Constraint) Constraint

func (*Controller) Any

func (c *Controller) Any() Constraint

func (*Controller) AssertAnd

func (c *Controller) AssertAnd(value interface{}, constraints ...Constraint)

func (*Controller) AssertCallback

func (c *Controller) AssertCallback(value interface{}, callback func(value interface{}) bool)

func (*Controller) AssertContains

func (c *Controller) AssertContains(element interface{}, list interface{})

func (*Controller) AssertElements

func (c *Controller) AssertElements(constraints []Constraint, actual ...interface{})

func (*Controller) AssertEmpty

func (c *Controller) AssertEmpty(value interface{})

func (*Controller) AssertEqual

func (c *Controller) AssertEqual(expected interface{}, actual interface{}, options ...interface{})

func (*Controller) AssertFalse

func (c *Controller) AssertFalse(value interface{})

func (*Controller) AssertGreater

func (c *Controller) AssertGreater(expected interface{}, actual interface{})

func (*Controller) AssertGreaterOrEqual

func (c *Controller) AssertGreaterOrEqual(expected interface{}, actual interface{}, delta float64)

func (*Controller) AssertKind

func (c *Controller) AssertKind(value interface{}, expectedKinds ...reflect.Kind)

func (*Controller) AssertLength

func (c *Controller) AssertLength(length int, value interface{})

func (*Controller) AssertLengthGreater

func (c *Controller) AssertLengthGreater(length int, value interface{})

func (*Controller) AssertLengthGreaterOrEqual

func (c *Controller) AssertLengthGreaterOrEqual(length int, value interface{})

func (*Controller) AssertLengthLess

func (c *Controller) AssertLengthLess(length int, value interface{})

func (*Controller) AssertLengthLessOrEqual

func (c *Controller) AssertLengthLessOrEqual(length int, value interface{})

func (*Controller) AssertLess

func (c *Controller) AssertLess(expected interface{}, actual interface{})

func (*Controller) AssertLessOrEqual

func (c *Controller) AssertLessOrEqual(expected interface{}, actual interface{}, delta float64)

func (*Controller) AssertNil

func (c *Controller) AssertNil(value interface{})

func (*Controller) AssertNot

func (c *Controller) AssertNot(constraint Constraint, value interface{})

func (*Controller) AssertNotCallback

func (c *Controller) AssertNotCallback(value interface{}, callback func(value interface{}) bool)

func (*Controller) AssertNotContains

func (c *Controller) AssertNotContains(element interface{}, list interface{})

func (*Controller) AssertNotElements

func (c *Controller) AssertNotElements(constraints []Constraint, actual ...interface{})

func (*Controller) AssertNotEmpty

func (c *Controller) AssertNotEmpty(value interface{})

func (*Controller) AssertNotEqual

func (c *Controller) AssertNotEqual(expected interface{}, actual interface{}, options ...interface{})

func (*Controller) AssertNotKind

func (c *Controller) AssertNotKind(value interface{}, expectedKinds ...reflect.Kind)

func (*Controller) AssertNotLength

func (c *Controller) AssertNotLength(length int, value interface{})

func (*Controller) AssertNotNil

func (c *Controller) AssertNotNil(value interface{})

func (*Controller) AssertNotRegexp

func (c *Controller) AssertNotRegexp(pattern string, value interface{})

func (*Controller) AssertNotSame

func (c *Controller) AssertNotSame(expected interface{}, actual interface{})

func (*Controller) AssertNotType

func (c *Controller) AssertNotType(value interface{}, expectedTypes ...interface{})

func (*Controller) AssertNotValue

func (c *Controller) AssertNotValue(expected interface{}, actual interface{}, options ...interface{})

func (*Controller) AssertNotValueElements

func (c *Controller) AssertNotValueElements(expected []interface{}, actual []interface{}, options ...interface{})

func (*Controller) AssertOr

func (c *Controller) AssertOr(value interface{}, constraints ...Constraint)

func (*Controller) AssertRegexp

func (c *Controller) AssertRegexp(pattern string, value interface{})

func (*Controller) AssertSame

func (c *Controller) AssertSame(expected interface{}, actual interface{})

func (*Controller) AssertThat

func (c *Controller) AssertThat(value interface{}, constraint Constraint, context string) *Controller

func (*Controller) AssertTrue

func (c *Controller) AssertTrue(value interface{})

func (*Controller) AssertType

func (c *Controller) AssertType(value interface{}, expectedTypes ...interface{})

func (*Controller) AssertValue

func (c *Controller) AssertValue(expected interface{}, actual interface{}, options ...interface{})

func (*Controller) AssertValueElements

func (c *Controller) AssertValueElements(expected []interface{}, actual []interface{}, options ...interface{})

func (*Controller) Callback

func (c *Controller) Callback(callback func(value interface{}) bool) Constraint

func (*Controller) Contains

func (c *Controller) Contains(element interface{}, options ...interface{}) Constraint

func (*Controller) Elements

func (c *Controller) Elements(constraints ...Constraint) Constraint

func (*Controller) Empty

func (c *Controller) Empty() Constraint

func (*Controller) Equal

func (c *Controller) Equal(expected interface{}, options ...interface{}) Constraint

func (*Controller) False

func (c *Controller) False() Constraint

func (*Controller) Finish

func (c *Controller) Finish()

func (*Controller) Greater

func (c *Controller) Greater(expected interface{}) Constraint

func (*Controller) GreaterOrEqual

func (c *Controller) GreaterOrEqual(expected interface{}, delta float64) Constraint

func (*Controller) Kind

func (c *Controller) Kind(allowedKinds ...reflect.Kind) Constraint

func (*Controller) Length

func (c *Controller) Length(length int) Constraint

func (*Controller) LengthGreater

func (c *Controller) LengthGreater(length int) Constraint

func (*Controller) LengthGreaterOrEqual

func (c *Controller) LengthGreaterOrEqual(length int) Constraint

func (*Controller) LengthLess

func (c *Controller) LengthLess(length int) Constraint

func (*Controller) LengthLessOrEqual

func (c *Controller) LengthLessOrEqual(length int) Constraint

func (*Controller) Less

func (c *Controller) Less(expected interface{}) Constraint

func (*Controller) LessOrEqual

func (c *Controller) LessOrEqual(expected interface{}, delta float64) Constraint

func (*Controller) Nil

func (c *Controller) Nil() Constraint

func (*Controller) Not

func (c *Controller) Not(constraint Constraint) Constraint

func (*Controller) NotCallback

func (c *Controller) NotCallback(callback func(value interface{}) bool) Constraint

func (*Controller) NotContains

func (c *Controller) NotContains(element interface{}, options ...interface{}) Constraint

func (*Controller) NotElements

func (c *Controller) NotElements(constraints ...Constraint) Constraint

func (*Controller) NotEmpty

func (c *Controller) NotEmpty() Constraint

func (*Controller) NotEqual

func (c *Controller) NotEqual(expected interface{}, options ...interface{}) Constraint

func (*Controller) NotKind

func (c *Controller) NotKind(allowedKinds ...reflect.Kind) Constraint

func (*Controller) NotLength

func (c *Controller) NotLength(length int) Constraint

func (*Controller) NotNil

func (c *Controller) NotNil() Constraint

func (*Controller) NotRegexp

func (c *Controller) NotRegexp(pattern string) Constraint

func (*Controller) NotSame

func (c *Controller) NotSame(expected interface{}) Constraint

func (*Controller) NotType

func (c *Controller) NotType(allowedTypes ...interface{}) Constraint

func (*Controller) NotValue

func (c *Controller) NotValue(expected interface{}, options ...interface{}) Constraint

func (*Controller) NotValueElements

func (c *Controller) NotValueElements(expectedValues []interface{}, options ...interface{}) Constraint

func (*Controller) Or

func (c *Controller) Or(constraint ...Constraint) Constraint

func (*Controller) Regexp

func (c *Controller) Regexp(pattern string) Constraint

func (*Controller) RegisterFinish

func (c *Controller) RegisterFinish(finish func())

func (*Controller) Same

func (c *Controller) Same(expected interface{}) Constraint

func (*Controller) Subtest

func (c *Controller) Subtest(name string) *Subtest

func (*Controller) TestingT

func (c *Controller) TestingT() TestingT

func (*Controller) True

func (c *Controller) True() Constraint

func (*Controller) Type

func (c *Controller) Type(allowedTypes ...interface{}) Constraint

func (*Controller) Value

func (c *Controller) Value(expected interface{}, options ...interface{}) Constraint

func (*Controller) ValueElements

func (c *Controller) ValueElements(expectedValues []interface{}, options ...interface{}) Constraint

type ElementsConstraint

type ElementsConstraint struct {
	// contains filtered or unexported fields
}

func (*ElementsConstraint) Check

func (c *ElementsConstraint) Check(list interface{}) bool

func (*ElementsConstraint) Details

func (c *ElementsConstraint) Details(list interface{}) string

func (*ElementsConstraint) String

func (c *ElementsConstraint) String() string

type EmptyConstraint

type EmptyConstraint struct {
	// contains filtered or unexported fields
}

func (*EmptyConstraint) Check

func (c *EmptyConstraint) Check(value interface{}) bool

func (*EmptyConstraint) Details

func (c *EmptyConstraint) Details(value interface{}) string

func (*EmptyConstraint) String

func (c *EmptyConstraint) String() string

type EqualComparator

type EqualComparator struct {
	// contains filtered or unexported fields
}

func NewEqualComparator

func NewEqualComparator(options ...interface{}) *EqualComparator

func (*EqualComparator) Compare

func (c *EqualComparator) Compare(x interface{}, y interface{}) bool

func (*EqualComparator) Diff

func (c *EqualComparator) Diff(x interface{}, y interface{}) string

type EqualComparer

type EqualComparer interface {
	Compare(x interface{}, y interface{}) bool
	Diff(x interface{}, y interface{}) string
}

type EqualConstraint

type EqualConstraint struct {
	// contains filtered or unexported fields
}

func (*EqualConstraint) Check

func (c *EqualConstraint) Check(actual interface{}) bool

func (*EqualConstraint) Details

func (c *EqualConstraint) Details(actual interface{}) string

func (*EqualConstraint) String

func (c *EqualConstraint) String() string

type Equaler

type Equaler interface {
	Equal(value interface{}) bool
}

type Error

type Error struct {
	// contains filtered or unexported fields
}

func NewAssertError

func NewAssertError(value interface{}, context string, assertion string, details string) *Error

func NewInvalidKindError

func NewInvalidKindError(name string, value interface{}, expectedKinds ...reflect.Kind) *Error

func NewInvalidLengthComparisonTypeError

func NewInvalidLengthComparisonTypeError(name string, value interface{}) *Error

func NewInvalidLengthError

func NewInvalidLengthError(variableName string, expectedLength int, actualLength int) *Error

func NewInvalidNilComparisonTypeError

func NewInvalidNilComparisonTypeError(name string, value interface{}) *Error

func NewInvalidNumericComparisonTypeError

func NewInvalidNumericComparisonTypeError(name string, value interface{}) *Error

func NewInvalidTypeError

func NewInvalidTypeError(name string, value interface{}, expectedTypes ...interface{}) *Error

func NewLengthNotLessError

func NewLengthNotLessError(variableName string, expectedLength int, actualLength int) *Error

func NewNotEmptyError

func NewNotEmptyError(name string) *Error

func NewNotNilError

func NewNotNilError(name string) *Error

func (*Error) Error

func (e *Error) Error() string

type FalseConstraint

type FalseConstraint struct {
}

func (*FalseConstraint) Check

func (c *FalseConstraint) Check(value interface{}) bool

func (*FalseConstraint) Details

func (c *FalseConstraint) Details(value interface{}) string

func (*FalseConstraint) String

func (c *FalseConstraint) String() string

type GreaterConstraint

type GreaterConstraint struct {
	// contains filtered or unexported fields
}

func (*GreaterConstraint) Check

func (c *GreaterConstraint) Check(actual interface{}) bool

func (*GreaterConstraint) Details

func (c *GreaterConstraint) Details(actual interface{}) string

func (*GreaterConstraint) String

func (c *GreaterConstraint) String() string

type IgnoreFieldsOption

type IgnoreFieldsOption struct {
	Type   interface{}
	Fields []string
}

type IgnoreUnexportedOption

type IgnoreUnexportedOption struct {
	Value interface{}
}

type KindConstraint

type KindConstraint struct {
	// contains filtered or unexported fields
}

func (*KindConstraint) Check

func (c *KindConstraint) Check(value interface{}) bool

func (*KindConstraint) Details

func (c *KindConstraint) Details(actual interface{}) string

func (*KindConstraint) String

func (c *KindConstraint) String() string

type LengthConstraint

type LengthConstraint struct {
	// contains filtered or unexported fields
}

func (*LengthConstraint) Check

func (c *LengthConstraint) Check(value interface{}) bool

func (*LengthConstraint) Details

func (c *LengthConstraint) Details(value interface{}) string

func (*LengthConstraint) String

func (c *LengthConstraint) String() string

type LengthGreaterConstraint

type LengthGreaterConstraint struct {
	// contains filtered or unexported fields
}

func (*LengthGreaterConstraint) Check

func (c *LengthGreaterConstraint) Check(value interface{}) bool

func (*LengthGreaterConstraint) Details

func (c *LengthGreaterConstraint) Details(value interface{}) string

func (*LengthGreaterConstraint) String

func (c *LengthGreaterConstraint) String() string

type LengthLessConstraint

type LengthLessConstraint struct {
	// contains filtered or unexported fields
}

func (*LengthLessConstraint) Check

func (c *LengthLessConstraint) Check(value interface{}) bool

func (*LengthLessConstraint) Details

func (c *LengthLessConstraint) Details(value interface{}) string

func (*LengthLessConstraint) String

func (c *LengthLessConstraint) String() string

type LessConstraint

type LessConstraint struct {
	// contains filtered or unexported fields
}

func (*LessConstraint) Check

func (c *LessConstraint) Check(actual interface{}) bool

func (*LessConstraint) Details

func (c *LessConstraint) Details(actual interface{}) string

func (*LessConstraint) String

func (c *LessConstraint) String() string

type NilConstraint

type NilConstraint struct {
}

func (*NilConstraint) Check

func (c *NilConstraint) Check(value interface{}) bool

func (*NilConstraint) Details

func (c *NilConstraint) Details(value interface{}) string

func (*NilConstraint) String

func (c *NilConstraint) String() string

type NotConstraint

type NotConstraint struct {
	// contains filtered or unexported fields
}

func (*NotConstraint) Check

func (c *NotConstraint) Check(actual interface{}) bool

func (*NotConstraint) Details

func (c *NotConstraint) Details(value interface{}) string

func (*NotConstraint) String

func (c *NotConstraint) String() string

type NumericDeltaOption

type NumericDeltaOption struct {
	Value float64
}

type OrConstraint

type OrConstraint struct {
	// contains filtered or unexported fields
}

func (*OrConstraint) Check

func (c *OrConstraint) Check(value interface{}) bool

func (*OrConstraint) Details

func (c *OrConstraint) Details(value interface{}) string

func (*OrConstraint) String

func (c *OrConstraint) String() string

type RegexpConstraint

type RegexpConstraint struct {
	// contains filtered or unexported fields
}

func (*RegexpConstraint) Check

func (c *RegexpConstraint) Check(value interface{}) bool

func (*RegexpConstraint) Details

func (c *RegexpConstraint) Details(value interface{}) string

func (*RegexpConstraint) String

func (c *RegexpConstraint) String() string

type SameConstraint

type SameConstraint struct {
	// contains filtered or unexported fields
}

func (*SameConstraint) Check

func (c *SameConstraint) Check(actual interface{}) bool

func (*SameConstraint) Details

func (c *SameConstraint) Details(actual interface{}) string

func (*SameConstraint) String

func (c *SameConstraint) String() string

type SamePointerOption

type SamePointerOption struct {
	Value bool
}

type SameTypeOption

type SameTypeOption struct {
	Value bool
}

type Subtest

type Subtest struct {
	// contains filtered or unexported fields
}

func NewSubtest

func NewSubtest(test TestingT, testName string) *Subtest

func (*Subtest) Call

func (d *Subtest) Call(callable interface{}, arguments ...interface{}) *Subtest

func (*Subtest) ExpectPanic

func (d *Subtest) ExpectPanic(expectedPanic interface{})

func (*Subtest) ExpectResult

func (d *Subtest) ExpectResult(expectedResults ...interface{})

func (*Subtest) SetCompareOptions

func (d *Subtest) SetCompareOptions(options ...interface{}) *Subtest

type TestingT

type TestingT interface {
	Name() string
	Helper()
	Errorf(format string, args ...interface{})
	Error(args ...interface{})
	Fail()
	Run(name string, test func(*testing.T)) bool
}

type TrueConstraint

type TrueConstraint struct {
}

func (*TrueConstraint) Check

func (c *TrueConstraint) Check(value interface{}) bool

func (*TrueConstraint) Details

func (c *TrueConstraint) Details(value interface{}) string

func (*TrueConstraint) String

func (c *TrueConstraint) String() string

type TypeConstraint

type TypeConstraint struct {
	// contains filtered or unexported fields
}

func (*TypeConstraint) Check

func (c *TypeConstraint) Check(value interface{}) bool

func (*TypeConstraint) Details

func (c *TypeConstraint) Details(value interface{}) string

func (*TypeConstraint) String

func (c *TypeConstraint) String() string

type UseEqualMethodOption

type UseEqualMethodOption struct {
	Value bool
}

Jump to

Keyboard shortcuts

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