summaryrefslogtreecommitdiffstats
path: root/pid_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'pid_test.go')
-rw-r--r--pid_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/pid_test.go b/pid_test.go
new file mode 100644
index 0000000..681b116
--- /dev/null
+++ b/pid_test.go
@@ -0,0 +1,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))
+ }
+}