xtesting

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: MIT Imports: 8 Imported by: 0

README

xtesting

Dependencies

  • None

Documents

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

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.TB, container, object interface{}, msgAndArgs ...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.TB, listA, listB interface{}, msgAndArgs ...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.TB, object interface{}, msgAndArgs ...interface{}) bool

Empty asserts that the specified object is empty.

func Equal

func Equal(t testing.TB, expected, actual interface{}, msgAndArgs ...interface{}) bool

Equal asserts that two objects are equal.

func EqualValue added in v1.4.2

func EqualValue(t testing.TB, expected, actual interface{}, msgAndArgs ...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.TB, value bool, msgAndArgs ...interface{}) bool

False asserts that the specified value is false.

func Implements added in v1.4.2

func Implements(t testing.TB, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool

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

func InDelta added in v1.4.2

func InDelta(t testing.TB, expected, actual interface{}, eps float64, msgAndArgs ...interface{}) 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.TB, expected interface{}, object interface{}, msgAndArgs ...interface{}) bool

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

func Nil added in v1.3.2

func Nil(t testing.TB, object interface{}, msgAndArgs ...interface{}) bool

Nil asserts that the specified object is nil.

func NotContain added in v1.4.2

func NotContain(t testing.TB, container, object interface{}, msgAndArgs ...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.TB, object interface{}, msgAndArgs ...interface{}) bool

NotEmpty asserts that the specified object is not empty.

func NotEqual

func NotEqual(t testing.TB, expected, actual interface{}, msgAndArgs ...interface{}) bool

NotEqual asserts that the specified values are Not equal.

func NotEqualValue added in v1.4.2

func NotEqualValue(t testing.TB, expected, actual interface{}, msgAndArgs ...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.TB, expected, actual interface{}, eps float64, msgAndArgs ...interface{}) 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.TB, object interface{}, msgAndArgs ...interface{}) bool

NotNil asserts that the specified object is not nil.

func NotPanic added in v1.4.2

func NotPanic(t testing.TB, f func(), msgAndArgs ...interface{}) bool

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

func NotSamePointer added in v1.4.2

func NotSamePointer(t testing.TB, expected, actual interface{}, msgAndArgs ...interface{}) bool

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

func NotZero added in v1.4.2

func NotZero(t testing.TB, object interface{}, msgAndArgs ...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.TB, f func(), msgAndArgs ...interface{}) bool

Panic asserts that the code inside the specified function panics.

func PanicWithValue added in v1.4.2

func PanicWithValue(t testing.TB, expected interface{}, f func(), msgAndArgs ...interface{}) 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.TB, expected, actual interface{}, msgAndArgs ...interface{}) bool

SamePointer asserts that two pointers reference the same object.

func True added in v1.3.4

func True(t testing.TB, value bool, msgAndArgs ...interface{}) bool

True asserts that the specified value is true.

func Zero added in v1.4.2

func Zero(t testing.TB, object interface{}, msgAndArgs ...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