Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions assert/assertion_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,15 @@ func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick
// If the condition is not met before waitFor, the collected errors of
// the last tick are copied to t.
//
// externalValue := false
// var externalValue int32
// go func() {
// time.Sleep(8*time.Second)
// externalValue = true
// atomic.StoreInt32(&externalValue, 1)
// }()
// assert.EventuallyWithTf(t, func(c *assert.CollectT) {
// // add assertions as needed; any assertion failure will fail the current tick
// assert.True(c, externalValue, "expected 'externalValue' to be true")
// isSet := atomic.LoadInt32(&externalValue) == 1
// assert.True(c, isSet, "expected 'externalValue' to be true")
// }, 10*time.Second, 1*time.Second, "error message %s", "formatted")
func EventuallyWithTf(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
Expand Down
14 changes: 8 additions & 6 deletions assert/assertion_forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,15 @@ func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, ti
// If the condition is not met before waitFor, the collected errors of
// the last tick are copied to t.
//
// externalValue := false
// var externalValue int32
// go func() {
// time.Sleep(8*time.Second)
// externalValue = true
// atomic.StoreInt32(&externalValue, 1)
// }()
// a.EventuallyWithT(func(c *assert.CollectT) {
// // add assertions as needed; any assertion failure will fail the current tick
// assert.True(c, externalValue, "expected 'externalValue' to be true")
// isSet := atomic.LoadInt32(&externalValue) == 1
// assert.True(c, isSet, "expected 'externalValue' to be true")
// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
func (a *Assertions) EventuallyWithT(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
Expand All @@ -367,14 +368,15 @@ func (a *Assertions) EventuallyWithT(condition func(collect *CollectT), waitFor
// If the condition is not met before waitFor, the collected errors of
// the last tick are copied to t.
//
// externalValue := false
// var externalValue int32
// go func() {
// time.Sleep(8*time.Second)
// externalValue = true
// atomic.StoreInt32(&externalValue, 1)
// }()
// a.EventuallyWithTf(func(c *assert.CollectT) {
// // add assertions as needed; any assertion failure will fail the current tick
// assert.True(c, externalValue, "expected 'externalValue' to be true")
// isSet := atomic.LoadInt32(&externalValue) == 1
// assert.True(c, isSet, "expected 'externalValue' to be true")
// }, 10*time.Second, 1*time.Second, "error message %s", "formatted")
func (a *Assertions) EventuallyWithTf(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
Expand Down
7 changes: 4 additions & 3 deletions assert/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2090,14 +2090,15 @@ func (c *CollectT) failed() bool {
// If the condition is not met before waitFor, the collected errors of
// the last tick are copied to t.
//
// externalValue := false
// var externalValue int32
// go func() {
// time.Sleep(8*time.Second)
// externalValue = true
// atomic.StoreInt32(&externalValue, 1)
// }()
// assert.EventuallyWithT(t, func(c *assert.CollectT) {
// // add assertions as needed; any assertion failure will fail the current tick
// assert.True(c, externalValue, "expected 'externalValue' to be true")
// isSet := atomic.LoadInt32(&externalValue) == 1
// assert.True(c, isSet, "expected 'externalValue' to be true")
// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
Expand Down
14 changes: 8 additions & 6 deletions require/require.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,15 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t
// If the condition is not met before waitFor, the collected errors of
// the last tick are copied to t.
//
// externalValue := false
// var externalValue int32
// go func() {
// time.Sleep(8*time.Second)
// externalValue = true
// atomic.StoreInt32(&externalValue, 1)
// }()
// require.EventuallyWithT(t, func(c *assert.CollectT) {
// // add assertions as needed; any assertion failure will fail the current tick
// require.True(c, externalValue, "expected 'externalValue' to be true")
// isSet := atomic.LoadInt32(&externalValue) == 1
// require.True(c, isSet, "expected 'externalValue' to be true")
// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
func EventuallyWithT(t TestingT, condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {
if h, ok := t.(tHelper); ok {
Expand All @@ -452,14 +453,15 @@ func EventuallyWithT(t TestingT, condition func(collect *assert.CollectT), waitF
// If the condition is not met before waitFor, the collected errors of
// the last tick are copied to t.
//
// externalValue := false
// var externalValue int32
// go func() {
// time.Sleep(8*time.Second)
// externalValue = true
// atomic.StoreInt32(&externalValue, 1)
// }()
// require.EventuallyWithTf(t, func(c *assert.CollectT) {
// // add assertions as needed; any assertion failure will fail the current tick
// require.True(c, externalValue, "expected 'externalValue' to be true")
// isSet := atomic.LoadInt32(&externalValue) == 1
// require.True(c, isSet, "expected 'externalValue' to be true")
// }, 10*time.Second, 1*time.Second, "error message %s", "formatted")
func EventuallyWithTf(t TestingT, condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {
if h, ok := t.(tHelper); ok {
Expand Down
14 changes: 8 additions & 6 deletions require/require_forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,15 @@ func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, ti
// If the condition is not met before waitFor, the collected errors of
// the last tick are copied to t.
//
// externalValue := false
// var externalValue int32
// go func() {
// time.Sleep(8*time.Second)
// externalValue = true
// atomic.StoreInt32(&externalValue, 1)
// }()
// a.EventuallyWithT(func(c *assert.CollectT) {
// // add assertions as needed; any assertion failure will fail the current tick
// assert.True(c, externalValue, "expected 'externalValue' to be true")
// isSet := atomic.LoadInt32(&externalValue) == 1
// assert.True(c, isSet, "expected 'externalValue' to be true")
// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
func (a *Assertions) EventuallyWithT(condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) {
if h, ok := a.t.(tHelper); ok {
Expand All @@ -368,14 +369,15 @@ func (a *Assertions) EventuallyWithT(condition func(collect *assert.CollectT), w
// If the condition is not met before waitFor, the collected errors of
// the last tick are copied to t.
//
// externalValue := false
// var externalValue int32
// go func() {
// time.Sleep(8*time.Second)
// externalValue = true
// atomic.StoreInt32(&externalValue, 1)
// }()
// a.EventuallyWithTf(func(c *assert.CollectT) {
// // add assertions as needed; any assertion failure will fail the current tick
// assert.True(c, externalValue, "expected 'externalValue' to be true")
// isSet := atomic.LoadInt32(&externalValue) == 1
// assert.True(c, isSet, "expected 'externalValue' to be true")
// }, 10*time.Second, 1*time.Second, "error message %s", "formatted")
func (a *Assertions) EventuallyWithTf(condition func(collect *assert.CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) {
if h, ok := a.t.(tHelper); ok {
Expand Down
Loading