diff --git a/workerpool_test.go b/workerpool_test.go index 779b8e7..6aff475 100644 --- a/workerpool_test.go +++ b/workerpool_test.go @@ -198,14 +198,6 @@ func TestWorkerPool(t *testing.T) { if err := wp.Close(); err != nil { t.Errorf("close: got '%v', want no error", err) } - - results, err := wp.Drain() - if err != ErrClosed { - t.Errorf("drain: got '%v', want '%v'", err, ErrClosed) - } - if results != nil { - t.Errorf("drain: got '%v', want '%v'", results, nil) - } } func TestConcurrentDrain(t *testing.T) { @@ -287,6 +279,18 @@ func TestConcurrentDrain(t *testing.T) { } } +func TestWorkerPoolDrainAfterClose(t *testing.T) { + wp := New(runtime.NumCPU()) + wp.Close() + tasks, err := wp.Drain() + if err != ErrClosed { + t.Errorf("got %v; want %v", err, ErrClosed) + } + if tasks != nil { + t.Errorf("got %v as tasks; want %v", tasks, nil) + } +} + func TestWorkerPoolSubmitAfterClose(t *testing.T) { wp := New(runtime.NumCPU()) wp.Close()