diff options
author | Alexander Kiryukhin <alexander@kiryukhin.su> | 2019-03-27 02:44:38 +0300 |
---|---|---|
committer | Alexander Kiryukhin <alexander@kiryukhin.su> | 2019-03-27 02:44:38 +0300 |
commit | d45d913c9e0d088f339c007f14d2fcaa7b9c8c74 (patch) | |
tree | 486d43d7359b5842f6f34b814764389fa27640d2 /rutina_test.go | |
parent | 11a32ca219905f7c42698b55b6af9920626b7b51 (diff) |
Flexible run policiesv0.3.0
Options refactoring
Diffstat (limited to 'rutina_test.go')
-rwxr-xr-x | rutina_test.go | 10 |
1 files changed, 5 insertions, 5 deletions
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) } |