gearman-go/src/gearman/client_test.go
mikespook e902ac0573 Move the source files from src/ to src/gearman/.
--HG--
rename : src/Makefile => src/gearman/Makefile
rename : src/client.go => src/gearman/client.go
rename : src/client/job.go => src/gearman/client/job.go
rename : src/client_test.go => src/gearman/client_test.go
rename : src/gearman.go => src/gearman/gearman.go
rename : src/worker.go => src/gearman/worker.go
rename : src/worker/job.go => src/gearman/worker/job.go
rename : src/worker/jobclient.go => src/gearman/worker/jobclient.go
rename : src/worker_test.go => src/gearman/worker_test.go
2011-09-17 16:53:17 +08:00

42 lines
766 B
Go

package gearman
import (
"testing"
// "os"
)
var client *Client
func init() {
client = NewClient()
}
func TestClientAddServer(t *testing.T) {
t.Log("Add local server 127.0.0.1:4730")
if err := client.AddServer("127.0.0.1:4730"); err != nil {
t.Error(err)
}
}
func TestClientEcho(t *testing.T) {
if echo, err := client.Echo([]byte("Hello world")); err != nil {
t.Error(err)
} else {
t.Log(echo)
}
}
func TestClientDo(t *testing.T) {
if handle, err := client.Do("ToUpper", []byte("abcdef"), JOB_LOW|JOB_BG); err != nil {
t.Error(err)
} else {
t.Log(handle)
}
}
func TestClientClose(t *testing.T) {
if err := client.Close(); err != nil {
t.Error(err)
}
}