Documentation ¶
Index ¶
- func Contains(t T, list interface{}, element interface{}, argAndOpts ...interface{}) bool
- func DirExists(t T, path string, argAndOpts ...interface{}) bool
- func Empty(t T, object interface{}, argAndOpts ...interface{}) bool
- func Equal(t T, expected, actual interface{}, argAndOpts ...interface{}) bool
- func False(t T, value bool, argAndOpts ...interface{}) bool
- func FileExists(t T, path string, argAndOpts ...interface{}) bool
- func Greater(t T, expected, actual interface{}, argAndOpts ...interface{}) bool
- func GreaterEqual(t T, expected, actual interface{}, argAndOpts ...interface{}) bool
- func IsDecreasing(t T, object interface{}, argAndOpts ...interface{}) bool
- func IsIncreasing(t T, object interface{}, argAndOpts ...interface{}) bool
- func IsNonDecreasing(t T, object interface{}, argAndOpts ...interface{}) bool
- func IsNonIncreasing(t T, object interface{}, argAndOpts ...interface{}) bool
- func IsType(t T, expectedType interface{}, object interface{}, argAndOpts ...interface{}) bool
- func Len(t T, object interface{}, length int, argAndOpts ...interface{}) bool
- func Less(t T, expected, actual interface{}, argAndOpts ...interface{}) bool
- func LessEqual(t T, expected, actual interface{}, argAndOpts ...interface{}) bool
- func Negative(t T, expected interface{}, argAndOpts ...interface{}) bool
- func Nil(t T, object interface{}, argAndOpts ...interface{}) bool
- func NoDirExists(t T, path string, argAndOpts ...interface{}) bool
- func NoFileExists(t T, path string, argAndOpts ...interface{}) bool
- func NotEmpty(t T, object interface{}, argAndOpts ...interface{}) bool
- func NotEqual(t T, expected, actual interface{}, argAndOpts ...interface{}) bool
- func NotNil(t T, object interface{}, argAndOpts ...interface{}) bool
- func NotSame(t T, expected, actual interface{}, argAndOpts ...interface{}) bool
- func NotZero(t T, object interface{}, argAndOpts ...interface{}) bool
- func Positive(t T, expected interface{}, argAndOpts ...interface{}) bool
- func Same(t T, expected, actual interface{}, argAndOpts ...interface{}) bool
- func True(t T, value bool, argAndOpts ...interface{}) bool
- func Zero(t T, object interface{}, argAndOpts ...interface{}) bool
- type Assertion
- func (a *Assertion) Contains(s interface{}, contains interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) DirExists(path string, argAndOpts ...interface{}) bool
- func (a *Assertion) Empty(object interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) Equal(expected, actual interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) False(value bool, argAndOpts ...interface{}) bool
- func (a *Assertion) FileExists(path string, argAndOpts ...interface{}) bool
- func (a *Assertion) Greater(expected, actual interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) GreaterEqual(expected, actual interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) IsDecreasing(expected interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) IsIncreasing(expected interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) IsNonDecreasing(expected interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) IsNonIncreasing(expected interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) IsType(expected, object interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) Len(object interface{}, length int, argAndOpts ...interface{}) bool
- func (a *Assertion) Less(expected, actual interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) LessEqual(expected, actual interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) Negative(expected interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) Nil(object interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) NoDirExists(path string, argAndOpts ...interface{}) bool
- func (a *Assertion) NoFileExists(path string, argAndOpts ...interface{}) bool
- func (a *Assertion) NotEmpty(object interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) NotEqual(expected, actual interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) NotNil(object interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) NotSame(expected, object interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) NotZero(object interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) Positive(expected interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) Same(expected, object interface{}, argAndOpts ...interface{}) bool
- func (a *Assertion) True(value bool, argAndOpts ...interface{}) bool
- func (a *Assertion) Zero(object interface{}, argAndOpts ...interface{}) bool
- type Option
- type Options
- type T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirExists ¶
DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
func Empty ¶
Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either a slice or a channel with len == 0.
assert.Empty(t, obj)
func FileExists ¶
func Greater ¶
Greater asserts that the first element is greater than the second
assert.Greater(t, 2, 1) assert.Greater(t, float64(2), float64(1)) assert.Greater(t, "b", "a")
func GreaterEqual ¶
func IsDecreasing ¶
IsDecreasing asserts that the collection is decreasing
assert.IsDecreasing(t, []int{2, 1, 0}) assert.IsDecreasing(t, []float{2, 1}) assert.IsDecreasing(t, []string{"b", "a"})
func IsIncreasing ¶
IsIncreasing asserts that the collection is increasing
assert.IsIncreasing(t, []int{1, 2, 3}) assert.IsIncreasing(t, []float{1, 2}) assert.IsIncreasing(t, []string{"a", "b"})
func IsNonDecreasing ¶
IsNonDecreasing asserts that the collection is not decreasing
assert.IsNonDecreasing(t, []int{1, 1, 2}) assert.IsNonDecreasing(t, []float{1, 2}) assert.IsNonDecreasing(t, []string{"a", "b"})
func IsNonIncreasing ¶
IsNonIncreasing asserts that the collection is not increasing
assert.IsNonIncreasing(t, []int{2, 1, 1}) assert.IsNonIncreasing(t, []float{2, 1}) assert.IsNonIncreasing(t, []string{"b", "a"})
func Len ¶
Len asserts that the specified object has specific length. Len also fails if the object has a type that len() not accept.
assert.Len(t, mySlice, 3)
func Negative ¶
Negative asserts that the specified element is negative
assert.Negative(t, -1) assert.Negative(t, -1.23)
func NoDirExists ¶
func NoFileExists ¶
func NotEmpty ¶
NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either a slice or a channel with len == 0.
if assert.NotEmpty(t, obj) { assert.Equal(t, "two", obj[1]) }
func NotSame ¶
NotSame asserts that two pointers do not reference the same object.
assert.NotSame(t, ptr1, ptr2)
Both arguments must be pointer variables. Pointer variable sameness is determined based on the equality of both type and value.
func Positive ¶
Positive asserts that the specified element is positive
assert.Positive(t, 1) assert.Positive(t, 1.23)
func Same ¶
Same asserts that two pointers reference the same object.
assert.Same(t, ptr1, ptr2)
Both arguments must be pointer variables. Pointer variable sameness is determined based on the equality of both type and value.
Types ¶
type Assertion ¶
type Assertion struct {
// contains filtered or unexported fields
}
Assertions provides assertion methods around the TestingT interface.
func (*Assertion) FileExists ¶
func (*Assertion) GreaterEqual ¶
func (*Assertion) IsDecreasing ¶
func (*Assertion) IsIncreasing ¶
func (*Assertion) IsNonDecreasing ¶
func (*Assertion) IsNonIncreasing ¶
func (*Assertion) NoDirExists ¶
func (*Assertion) NoFileExists ¶
type T ¶
type T interface { // Fail indicates that the test has failed but // allowed execution to continue. Fail() // FailNow indicates that the test has failed and // aborts the test. // FailNow is called in strict mode (via New). FailNow() }
T reports when failures occur. testing.T implements this interface.