summaryrefslogtreecommitdiffstats
path: root/cmd_help_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd_help_test.go')
-rw-r--r--cmd_help_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/cmd_help_test.go b/cmd_help_test.go
new file mode 100644
index 0000000..9c9a930
--- /dev/null
+++ b/cmd_help_test.go
@@ -0,0 +1,29 @@
+package goctl
+
+import "testing"
+
+func TestHelp(t *testing.T) {
+ gc := start(t)
+ defer gc.Stop()
+
+ c := dial(t)
+ defer c.Close()
+
+ buf := []byte("help")
+ Write(c, buf)
+
+ buf, err := Read(c)
+ if err != nil {
+ t.Fatalf("Couldn't read from socket: %s.", err)
+ }
+
+ got := string(buf)
+ want := `Available commands:
+
+ help show this message
+ pid return the Unix process ID of this program
+ ping checks whether the connection is working`
+ if got != want {
+ t.Errorf("Didn't get proper help response.\nGot:\n'%s',\nWant:\n'%s'", got, want)
+ }
+}