then

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertThat

func AssertThat[A any](t gocrest.TestingT, actual A, m *gocrest.Matcher[A])

AssertThat calls a given matcher and fails the test with a message if the matcher doesn't match.

func Eventually added in v1.0.7

func Eventually(t gocrest.TestingT, waitFor, tick time.Duration, assertions func(eventually gocrest.TestingT))

Eventually retries a set of assertions passed into it from a function. waitFor is the amount of time to wait for the assertions to pass. tick is the amount of time between running the assertions assertions are the function containing the assertions. e.g: ```

then.Eventually(t, time.Second*5, time.Second, func(eventually gocrest.TestingT) {
	then.AssertThat(eventually, by.Channelling(channel), is.EqualTo(3).Reason("should not fail"))
})

```

func WithinFiveSeconds added in v1.0.7

func WithinFiveSeconds(t gocrest.TestingT, assertions func(eventually gocrest.TestingT))

WithinFiveSeconds is a shortcut for a five-second Eventually call with one second tick

func WithinTenSeconds added in v1.0.7

func WithinTenSeconds(t gocrest.TestingT, assertions func(eventually gocrest.TestingT))

WithinTenSeconds is a shortcut for a ten-second Eventually call with one second tick

Types

type FailureLog added in v1.0.8

type FailureLog struct {
	TestOutput string
	// contains filtered or unexported fields
}

FailureLog is a type that holds temporary test data whilst Eventually runs

type Latest added in v1.0.7

type Latest struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Latest is used internally by Eventually to record the last recorded test output from assertions passed into it Only used with Eventually

func (*Latest) Get added in v1.0.7

func (l *Latest) Get() RecordingTestingT

Get is used internally by Eventually to Get the last recorded test output from assertions passed into it Only used with Eventually

func (*Latest) Merge added in v1.0.8

func (l *Latest) Merge(updated RecordingTestingT) RecordingTestingT

Merge is used internally by Eventually to Merge the latest recorded test output from assertions passed into it with the last one Only used with Eventually

type RecordingTestingT added in v1.0.7

type RecordingTestingT struct {
	sync.Mutex
	gocrest.TestingT
	// contains filtered or unexported fields
}

RecordingTestingT is a testingT interface that holds temporary test data whilst Eventually runs. Only used with Eventually

func (*RecordingTestingT) Errorf added in v1.0.7

func (t *RecordingTestingT) Errorf(format string, args ...interface{})

Errorf appends an error message into the failure buffer. Only used with Eventually

func (*RecordingTestingT) Fail added in v1.0.7

func (t *RecordingTestingT) Fail()

Fail calls Errorf with a generic failure message in case the test is failed from inside the value under test. Only used with Eventually

func (*RecordingTestingT) FailNow added in v1.0.7

func (t *RecordingTestingT) FailNow()

FailNow calls Errorf with a generic failure message in case the test is failed from inside the value under test. Only used with Eventually

func (*RecordingTestingT) FailedTestOutputs added in v1.0.8

func (t *RecordingTestingT) FailedTestOutputs() []string

FailedTestOutputs retrieves the list of recorded testing.T failures from the assertions passed in for Eventually evaluation. Only used with Eventually

func (*RecordingTestingT) Failing added in v1.0.8

func (t *RecordingTestingT) Failing() bool

Failing determines whether any of the Eventually assertions are still failing. Only used with Eventually

Jump to

Keyboard shortcuts

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