summaryrefslogtreecommitdiffstats
path: root/pid_test.go
blob: 681b11665be61ee1dc2510e9933bf981735ab33d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package goctl

import (
	"strconv"
	"testing"
)

func TestPID(t *testing.T) {
	gc := start(t)
	defer gc.Stop()

	c := dial(t)
	defer c.Close()

	buf := []byte("pid")
	Write(c, buf)

	buf, err := Read(c)
	if err != nil {
		t.Fatalf("Couldn't read from socket: %s.", err)
	}
	if _, err = strconv.Atoi(string(buf)); err != nil {
		t.Errorf("Requesting PID: got non-integer: '%s'.", string(buf))
	}
}