diff options
Diffstat (limited to 'ping_test.go')
-rw-r--r-- | ping_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ping_test.go b/ping_test.go new file mode 100644 index 0000000..89a08c7 --- /dev/null +++ b/ping_test.go @@ -0,0 +1,23 @@ +package goctl + +import "testing" + +func TestPing(t *testing.T) { + gc := start(t) + defer gc.Stop() + + c := dial(t) + defer c.Close() + + buf := []byte("ping") + Write(c, buf) + + buf, err := Read(c) + if err != nil { + t.Fatalf("Couldn't read from socket: %s.", err) + } + s := string(buf) + if s != "pong" { + t.Errorf("Sending ping: got '%s', expected 'pong'.", s) + } +} |