xtesting

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: MIT Imports: 8 Imported by: 0

README

xtesting

References
  • None
Functions
Test Functions
  • Equal(t *testing.T, expected, actual interface{}) bool
  • NotEqual(t *testing.T, expected, actual interface{}) bool
  • EqualValue(t *testing.T, expected, actual interface{}) bool
  • NotEqualValue(t *testing.T, expected, actual interface{}) bool
  • SamePointer(t *testing.T, expected, actual interface{}) bool
  • NotSamePointer(t *testing.T, expected, actual interface{}) bool
  • Nil(t *testing.T, object interface{}) bool
  • NotNil(t *testing.T, object interface{}) bool
  • True(t *testing.T, value bool) bool
  • False(t *testing.T, value bool) bool
  • Zero(t *testing.T, object interface{}) bool
  • NotZero(t *testing.T, object interface{}) bool
  • Empty(t *testing.T, object interface{}) bool
  • NotEmpty(t *testing.T, object interface{}) bool
  • Contain(t *testing.T, container, object interface{}) bool
  • NotContain(t *testing.T, container, object interface{}) bool
  • ElementMatch(t *testing.T, listA, listB interface{}) bool
  • Implements(t *testing.T, interfaceObject interface{}, object interface{}) bool
  • IsType(t *testing.T, expected interface{}, object interface{}) bool
  • Panic(t *testing.T, f func()) bool
  • NotPanic(t *testing.T, f func()) bool
  • PanicWithValue(t *testing.T, expected interface{}, f func()) bool
  • InDelta(t *testing.T, expected, actual interface{}, eps float64) bool
  • NotInDelta(t *testing.T, expected, actual interface{}, eps float64) bool
Common Functions
  • Assert(condition bool, format string, v ...interface{}) bool
  • IsObjectEqual(expected, actual interface{}) bool
  • IsObjectValueEqual(expected, actual interface{}) bool
  • IsPointerSame(first, second interface{}) bool
  • IsObjectNil(object interface{}) bool
  • IsObjectZero(object interface{}) bool
  • IsObjectEmpty(object interface{}) bool

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert added in v1.4.1

func Assert(condition bool, format string, v ...interface{}) bool

Assert panics when condition is false.

func Contain added in v1.4.2

func Contain(t *testing.T, container, object interface{}) bool

Contain asserts that the specified container contains the specified substring or element. Support string, array, slice or map.

func ElementMatch added in v1.4.2

func ElementMatch(t *testing.T, listA, listB interface{}) bool

ElementMatch asserts that the specified listA is equal to specified listB ignoring the order of the elements. If there are duplicate elements, the number of appearances of each of them in both lists should match.

func Empty added in v1.4.2

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

Empty asserts that the specified object is empty.

func Equal

func Equal(t *testing.T, expected, actual interface{}) bool

Equal asserts that two objects are equal.

func EqualValue added in v1.4.2

func EqualValue(t *testing.T, expected, actual interface{}) bool

EqualValue asserts that two objects are equal or convertible to the same types and equal.

func False added in v1.3.4

func False(t *testing.T, value bool) bool

False asserts that the specified value is false.

func Implements added in v1.4.2

func Implements(t *testing.T, interfaceObject interface{}, object interface{}) bool

Implements asserts that an object is implemented by the specified interface.

func InDelta added in v1.4.2

func InDelta(t *testing.T, expected, actual interface{}, eps float64) bool

InDelta asserts that the two numerals are within delta of each other.

func IsObjectEmpty added in v1.4.2

func IsObjectEmpty(object interface{}) bool

IsObjectEmpty gets whether the specified object is considered empty or not. Example:

  1. Array, Chan, Map, Slice -> Len = 0
  2. Ptr -> ptr == nil || ptr == nil

`3. Other -> zero value

func IsObjectEqual added in v1.4.2

func IsObjectEqual(expected, actual interface{}) bool

IsObjectEqual determines if two objects are considered equal.

func IsObjectNil added in v1.4.2

func IsObjectNil(object interface{}) bool

IsObjectNil checks if a specified object is nil or not.

func IsObjectValueEqual added in v1.4.2

func IsObjectValueEqual(expected, actual interface{}) bool

IsObjectValueEqual gets whether two objects are equal, or if their values are equal.

func IsObjectZero added in v1.4.2

func IsObjectZero(object interface{}) bool

IsObjectZero gets whether the specified object is the zero value of its type.

func IsPointerSame added in v1.4.2

func IsPointerSame(first, second interface{}) bool

IsPointerSame compares two generic interface objects and returns whether they point to the same object.

func IsType added in v1.4.2

func IsType(t *testing.T, expected interface{}, object interface{}) bool

IsType asserts that the specified objects are of the same type.

func Nil added in v1.3.2

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

Nil asserts that the specified object is nil.

func NotContain added in v1.4.2

func NotContain(t *testing.T, container, object interface{}) bool

NotContain asserts that the specified container does not contain the specified substring or element. Support string, array, slice or map.

func NotEmpty added in v1.4.2

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

NotEmpty asserts that the specified object is not empty.

func NotEqual

func NotEqual(t *testing.T, expected, actual interface{}) bool

NotEqual asserts that the specified values are Not equal.

func NotEqualValue added in v1.4.2

func NotEqualValue(t *testing.T, expected, actual interface{}) bool

NotEqualValue asserts that two objects are not equal even when converted to the same type.

func NotInDelta added in v1.4.2

func NotInDelta(t *testing.T, expected, actual interface{}, eps float64) bool

NotInDelta asserts that the two numerals are not within delta of each other.

func NotNil added in v1.3.2

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

NotNil asserts that the specified object is not nil.

func NotPanic added in v1.4.2

func NotPanic(t *testing.T, f func()) bool

NotPanic asserts that the code inside the specified function does not panic.

func NotSamePointer added in v1.4.2

func NotSamePointer(t *testing.T, expected, actual interface{}) bool

NotSamePointer asserts that two pointers do not reference the same object.

func NotZero added in v1.4.2

func NotZero(t *testing.T, object interface{}) bool

NotEmpty asserts that the specified object is not the zero value for its type.

func Panic added in v1.4.2

func Panic(t *testing.T, f func()) bool

Panic asserts that the code inside the specified function panics.

func PanicWithValue added in v1.4.2

func PanicWithValue(t *testing.T, expected interface{}, f func()) bool

PanicWithValue asserts that the code inside the specified function panics, and the recovered value equals the expected value.

func SamePointer added in v1.4.2

func SamePointer(t *testing.T, expected, actual interface{}) bool

SamePointer asserts that two pointers reference the same object.

func True added in v1.3.4

func True(t *testing.T, value bool) bool

True asserts that the specified value is true.

func Zero added in v1.4.2

func Zero(t *testing.T, object interface{}) bool

Zero asserts that the specified object is the zero value for its type.

Types

This section is empty.

Jump to

Keyboard shortcuts

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