From d45d913c9e0d088f339c007f14d2fcaa7b9c8c74 Mon Sep 17 00:00:00 2001 From: Alexander Kiryukhin Date: Wed, 27 Mar 2019 02:44:38 +0300 Subject: Flexible run policies Options refactoring --- rutina_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'rutina_test.go') diff --git a/rutina_test.go b/rutina_test.go index 077f68e..0c6d94a 100755 --- a/rutina_test.go +++ b/rutina_test.go @@ -8,7 +8,7 @@ import ( ) func TestSuccess(t *testing.T) { - r, _ := New( + r := New( WithStdLogger(), WithContext(context.Background()), ) @@ -40,7 +40,7 @@ func TestSuccess(t *testing.T) { } func TestError(t *testing.T) { - r, _ := New(WithCancelByError()) + r := New() f := func(name string, ttl time.Duration) error { <-time.After(ttl) t.Log(name) @@ -65,12 +65,12 @@ func TestError(t *testing.T) { } func TestContext(t *testing.T) { - r, _ := New() + r := New() cc := false r.Go(func(ctx context.Context) error { <-time.After(1 * time.Second) return nil - }) + }, ShutdownIfDone) r.Go(func(ctx context.Context) error { select { case <-ctx.Done(): @@ -79,7 +79,7 @@ func TestContext(t *testing.T) { case <-time.After(3 * time.Second): return errors.New("Timeout") } - }) + }, ShutdownIfDone) if err := r.Wait(); err != nil { t.Error("Unexpected error", err) } -- cgit v1.2.3