Skip to content

Commit

Permalink
test: record start time before creating context
Browse files Browse the repository at this point in the history
Signed-off-by: ghosind <[email protected]>
  • Loading branch information
ghosind committed Oct 29, 2024
1 parent 958829e commit c9f132d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion until_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ func TestUntilWithTestFunctionError(t *testing.T) {

func TestUntilWithContext(t *testing.T) {
a := assert.New(t)
start := time.Now()
ctx, canFunc := context.WithTimeout(context.Background(), 100*time.Millisecond)
defer canFunc()

start := time.Now()
out, err := async.UntilWithContext(ctx, func(ctx context.Context) bool {
select {
case <-ctx.Done():
Expand Down
2 changes: 1 addition & 1 deletion while_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ func TestWhileWithFunctionError(t *testing.T) {

func TestWhileWithContext(t *testing.T) {
a := assert.New(t)
start := time.Now()
ctx, canFunc := context.WithTimeout(context.Background(), 100*time.Millisecond)
defer canFunc()

start := time.Now()
out, err := async.WhileWithContext(ctx, func(ctx context.Context) bool {
select {
case <-ctx.Done():
Expand Down

0 comments on commit c9f132d

Please sign in to comment.