diff options
-rw-r--r-- | worker.go | 2 | ||||
-rw-r--r-- | worker_test.go | 14 |
2 files changed, 15 insertions, 1 deletions
@@ -76,7 +76,7 @@ func (w *Worker) State() State { func (w *Worker) String() string { state := w.state.String() if w.Pid != nil { - state = state + ", pid.php:" + strconv.Itoa(*w.Pid) + state = state + ", pid:" + strconv.Itoa(*w.Pid) } return fmt.Sprintf( diff --git a/worker_test.go b/worker_test.go index 0cb6f2d4..65adae28 100644 --- a/worker_test.go +++ b/worker_test.go @@ -42,6 +42,20 @@ func Test_Echo(t *testing.T) { assert.Equal(t, "hello", res.String()) } +func Test_String(t *testing.T) { + cmd := exec.Command("php", "tests/client.php", "echo", "pipes") + + w, _ := NewPipeFactory().SpawnWorker(cmd) + go func() { + assert.NoError(t, w.Wait()) + }() + defer w.Stop() + + assert.Contains(t, w.String(), "php tests/client.php echo pipes") + assert.Contains(t, w.String(), "ready") + assert.Contains(t, w.String(), "numExecs: 0") +} + func Test_Echo_Slow(t *testing.T) { cmd := exec.Command("php", "tests/slow-client.php", "echo", "pipes", "10", "10") |