From c9f132d48e90c0fe1f27b66ac11650ee7301c426 Mon Sep 17 00:00:00 2001 From: ghosind Date: Tue, 29 Oct 2024 23:02:50 +0800 Subject: [PATCH] test: record start time before creating context Signed-off-by: ghosind --- until_test.go | 2 +- while_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/until_test.go b/until_test.go index 49b2c30..ce18112 100644 --- a/until_test.go +++ b/until_test.go @@ -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(): diff --git a/while_test.go b/while_test.go index d09561a..db13e30 100644 --- a/while_test.go +++ b/while_test.go @@ -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():