Skip to content

Commit

Permalink
Improve WithinRange example
Browse files Browse the repository at this point in the history
  • Loading branch information
moolmanruan committed Jun 27, 2022
1 parent f0203c9 commit 7788bd3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion assert/assertion_format.go
Expand Up @@ -738,7 +738,7 @@ func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta tim

// WithinRangef asserts that a time is within a time range (inclusive).
//
// assert.WithinRangef(t, time.Now(), time.Now(), time.Now(), "error message %s", "formatted")
// assert.WithinRangef(t, time.Now(), time.Now().Sub(time.Second()), time.Now().Add(time.Second()), "error message %s", "formatted")
func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand Down
4 changes: 2 additions & 2 deletions assert/assertion_forward.go
Expand Up @@ -1463,7 +1463,7 @@ func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta

// WithinRange asserts that a time is within a time range (inclusive).
//
// a.WithinRange(time.Now(), time.Now(), time.Now())
// a.WithinRange(time.Now(), time.Now().Sub(time.Second()), time.Now().Add(time.Second()))
func (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
Expand All @@ -1473,7 +1473,7 @@ func (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Tim

// WithinRangef asserts that a time is within a time range (inclusive).
//
// a.WithinRangef(time.Now(), time.Now(), time.Now(), "error message %s", "formatted")
// a.WithinRangef(time.Now(), time.Now().Sub(time.Second()), time.Now().Add(time.Second()), "error message %s", "formatted")
func (a *Assertions) WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
Expand Down
2 changes: 1 addition & 1 deletion assert/assertions.go
Expand Up @@ -1111,7 +1111,7 @@ func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration,

// WithinRange asserts that a time is within a time range (inclusive).
//
// assert.WithinRange(t, time.Now(), time.Now(), time.Now())
// assert.WithinRange(t, time.Now(), time.Now().Sub(time.Second()), time.Now().Add(time.Second()))
func WithinRange(t TestingT, actual, start, end time.Time, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand Down
4 changes: 2 additions & 2 deletions require/require.go
Expand Up @@ -1866,7 +1866,7 @@ func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta tim

// WithinRange asserts that a time is within a time range (inclusive).
//
// assert.WithinRange(t, time.Now(), time.Now(), time.Now())
// assert.WithinRange(t, time.Now(), time.Now().Sub(time.Second()), time.Now().Add(time.Second()))
func WithinRange(t TestingT, actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand All @@ -1879,7 +1879,7 @@ func WithinRange(t TestingT, actual time.Time, start time.Time, end time.Time, m

// WithinRangef asserts that a time is within a time range (inclusive).
//
// assert.WithinRangef(t, time.Now(), time.Now(), time.Now(), "error message %s", "formatted")
// assert.WithinRangef(t, time.Now(), time.Now().Sub(time.Second()), time.Now().Add(time.Second()), "error message %s", "formatted")
func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand Down
4 changes: 2 additions & 2 deletions require/require_forward.go
Expand Up @@ -1464,7 +1464,7 @@ func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta

// WithinRange asserts that a time is within a time range (inclusive).
//
// a.WithinRange(time.Now(), time.Now(), time.Now())
// a.WithinRange(time.Now(), time.Now().Sub(time.Second()), time.Now().Add(time.Second()))
func (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) {
if h, ok := a.t.(tHelper); ok {
h.Helper()
Expand All @@ -1474,7 +1474,7 @@ func (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Tim

// WithinRangef asserts that a time is within a time range (inclusive).
//
// a.WithinRangef(time.Now(), time.Now(), time.Now(), "error message %s", "formatted")
// a.WithinRangef(time.Now(), time.Now().Sub(time.Second()), time.Now().Add(time.Second()), "error message %s", "formatted")
func (a *Assertions) WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) {
if h, ok := a.t.(tHelper); ok {
h.Helper()
Expand Down

0 comments on commit 7788bd3

Please sign in to comment.