Documentation ¶
Index ¶
- func ElementsEqual(tb testing.TB, expecteds interface{}, actuals interface{}, ...)
- func ElementsEqualOrErr(expecteds interface{}, actuals interface{}) error
- func ElementsEqualUnderFn(tb testing.TB, expecteds interface{}, actuals interface{}, ...)
- func Equal(tb testing.TB, expected interface{}, actual interface{}, ...)
- func EqualOneOf(tb testing.TB, expecteds interface{}, actual interface{}, ...)
- func False(tb testing.TB, value bool, msgAndArgs ...interface{})
- func Matches(tb testing.TB, expectedMatch string, actual string, msgAndArgs ...interface{})
- func Nil(tb testing.TB, object interface{}, msgAndArgs ...interface{})
- func NoError(tb testing.TB, err error, msgAndArgs ...interface{})
- func NoErrorWithinT(tb testing.TB, t time.Duration, f func() error, msgAndArgs ...interface{})
- func NoErrorWithinTRetry(tb testing.TB, t time.Duration, f func() error, msgAndArgs ...interface{})
- func NoneEquals(tb testing.TB, expected interface{}, actuals interface{}, ...)
- func NotEqual(tb testing.TB, expected interface{}, actual interface{}, ...)
- func NotNil(tb testing.TB, object interface{}, msgAndArgs ...interface{})
- func OneOfEquals(tb testing.TB, expected interface{}, actuals interface{}, ...)
- func OneOfMatches(tb testing.TB, expectedMatch string, actuals []string, ...)
- func True(tb testing.TB, value bool, msgAndArgs ...interface{})
- func YesError(tb testing.TB, err error, msgAndArgs ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ElementsEqual ¶ added in v1.7.0
func ElementsEqual(tb testing.TB, expecteds interface{}, actuals interface{}, msgAndArgs ...interface{})
ElementsEqual checks that the elements of the slice "expecteds" are exactly the elements of the slice "actuals", ignoring order (i.e. setwise-equal, but respecting duplicates).
Note that if the elements of 'expecteds' and 'actuals' are pointers, ElementsEqual will unwrap the pointers before comparing them, so that the output of e.g. ListCommit(), which returns []*pfs.Commit can easily be verfied.
Also, treat 'nil' and the empty slice as equivalent, so that callers can pass 'nil' for 'expecteds'.
func ElementsEqualOrErr ¶ added in v1.7.0
func ElementsEqualOrErr(expecteds interface{}, actuals interface{}) error
ElementsEqualOrErr returns nil if the elements of the slice "expecteds" are exactly the elements of the slice "actuals", ignoring order (i.e. setwise-equal), and an error otherwise.
Unlike other require.* functions, this returns an error, so that if the caller is polling e.g. ListCommit or ListAdmins, they can wrap ElementsEqualOrErr in a retry loop.
Also, like ElementsEqual, treat 'nil' and the empty slice as equivalent (for convenience)
func ElementsEqualUnderFn ¶ added in v1.7.0
func ElementsEqualUnderFn(tb testing.TB, expecteds interface{}, actuals interface{}, f func(interface{}) interface{}, msgAndArgs ...interface{})
ElementsEqualUnderFn checks that the elements of the slice 'expecteds' are exactly the images of every element of the slice 'actuals' under 'f', ignoring order (i.e. 'expecteds' and 'map(f, actuals)' are setwise-equal, but respecting duplicates). This is useful for cases where ElementsEqual doesn't quite work, e.g. because the type in 'expecteds'/'actuals' contains a pointer, or 'actuals' contains superfluous data which you wish to discard
Like ElementsEqual, treat 'nil' and the empty slice as equivalent (for convenience)
func EqualOneOf ¶
func EqualOneOf(tb testing.TB, expecteds interface{}, actual interface{}, msgAndArgs ...interface{})
EqualOneOf checks if a value is equal to one of the elements of a slice. Note that if expecteds and actual are a slice of pointers and a pointer respectively, then the pointers are unwrapped before comparison (so this functions works for e.g. *pfs.Commit and []*pfs.Commit)
func NoErrorWithinT ¶ added in v1.6.0
NoErrorWithinT checks that 'f' finishes within time 't' and does not emit an error
func NoErrorWithinTRetry ¶ added in v1.7.1
NoErrorWithinTRetry checks that 'f' finishes within time 't' and does not emit an error. Unlike NoErrorWithinT if f does error, it will retry it.
func NoneEquals ¶ added in v1.5.3
func NoneEquals(tb testing.TB, expected interface{}, actuals interface{}, msgAndArgs ...interface{})
NoneEquals checks one element of a slice equals a value. Like EqualsOneOf, NoneEquals unwraps pointers.
func OneOfEquals ¶
func OneOfEquals(tb testing.TB, expected interface{}, actuals interface{}, msgAndArgs ...interface{})
OneOfEquals checks whether one element of a slice equals a value. Like EqualsOneOf, OneOfEquals unwraps pointers
func OneOfMatches ¶ added in v1.7.2
OneOfMatches checks whether one element of a slice matches a regular-expression.
Types ¶
This section is empty.