예제 #1
0
func TestDialURLHost(t *testing.T) {
	checkHost := func(network, address string) (net.Conn, error) {
		if address != "localhost:6379" {
			t.Errorf("DialURL did not set host to localhost by default (got %v)", address)
		}
		return nil, nil
	}
	_, err := redis.DialURL("redis://:6379", redis.DialNetDial(checkHost))
	if err != nil {
		t.Error("dial error:", err)
	}
}
예제 #2
0
func dialTestConn(r io.Reader, w io.Writer) redis.DialOption {
	return redis.DialNetDial(func(net, addr string) (net.Conn, error) {
		return &testConn{Reader: r, Writer: w}, nil
	})
}