require

package
v1.7.0-d7c849200220d25... Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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 Equal

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

Equal checks equality of two values.

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 False

func False(tb testing.TB, value bool, msgAndArgs ...interface{})

False checks a value is false.

func InputEquals

func InputEquals(tb testing.TB, expected *pps.Input, actual *pps.Input, msgAndArgs ...interface{})

InputEquals checks whether a pps.Input expression equals another, expected expression (this assumes expected and actual are both valid)

func Matches

func Matches(tb testing.TB, expectedMatch string, actual string, msgAndArgs ...interface{})

Matches checks that a string matches a regular-expression.

func Nil

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

Nil checks a value is nil.

func NoError

func NoError(tb testing.TB, err error, msgAndArgs ...interface{})

NoError checks for no error.

func NoErrorWithinT added in v1.6.0

func NoErrorWithinT(tb testing.TB, t time.Duration, f func() error, msgAndArgs ...interface{})

NoErrorWithinT checks that 'f' finishes within time 't' and does not emit an error

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 NotEqual

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

NotEqual checks inequality of two values.

func NotNil

func NotNil(tb testing.TB, object interface{}, msgAndArgs ...interface{})

NotNil checks a value is non-nil.

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 True

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

True checks a value is true.

func YesError

func YesError(tb testing.TB, err error, msgAndArgs ...interface{})

YesError checks for an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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