forked from mirror/redis
request: Export ErrValNotSet.
This commit is contained in:
parent
49f3b6a2c5
commit
e7eb2a03f4
|
@ -1886,7 +1886,7 @@ func (t *RedisTest) TestPubSub(c *C) {
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
func (t *RedisTest) TestPipelining(c *C) {
|
func (t *RedisTest) TestPipeline(c *C) {
|
||||||
set := t.client.Set("foo2", "bar2")
|
set := t.client.Set("foo2", "bar2")
|
||||||
c.Assert(set.Err(), IsNil)
|
c.Assert(set.Err(), IsNil)
|
||||||
c.Assert(set.Val(), Equals, "OK")
|
c.Assert(set.Val(), Equals, "OK")
|
||||||
|
@ -1911,7 +1911,18 @@ func (t *RedisTest) TestPipelining(c *C) {
|
||||||
c.Assert(getReq.Val(), Equals, "bar2")
|
c.Assert(getReq.Val(), Equals, "bar2")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *RedisTest) TestRunQueuedOnEmptyQueue(c *C) {
|
func (t *RedisTest) TestPipelineErrValNotSet(c *C) {
|
||||||
|
pipeline, err := t.client.PipelineClient()
|
||||||
|
c.Assert(err, IsNil)
|
||||||
|
defer func() {
|
||||||
|
c.Assert(pipeline.Close(), IsNil)
|
||||||
|
}()
|
||||||
|
|
||||||
|
get := pipeline.Get("foo")
|
||||||
|
c.Check(get.Err(), Equals, redis.ErrValNotSet)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *RedisTest) TestPipelineRunQueuedOnEmptyQueue(c *C) {
|
||||||
pipeline, err := t.client.PipelineClient()
|
pipeline, err := t.client.PipelineClient()
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
defer func() {
|
defer func() {
|
||||||
|
@ -1923,7 +1934,7 @@ func (t *RedisTest) TestRunQueuedOnEmptyQueue(c *C) {
|
||||||
c.Assert(reqs, HasLen, 0)
|
c.Assert(reqs, HasLen, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *RedisTest) TestIncrPipeliningFromGoroutines(c *C) {
|
func (t *RedisTest) TestPipelineIncrFromGoroutines(c *C) {
|
||||||
pipeline, err := t.client.PipelineClient()
|
pipeline, err := t.client.PipelineClient()
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
defer func() {
|
defer func() {
|
||||||
|
@ -1954,7 +1965,7 @@ func (t *RedisTest) TestIncrPipeliningFromGoroutines(c *C) {
|
||||||
c.Assert(get.Val(), Equals, "20000")
|
c.Assert(get.Val(), Equals, "20000")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *RedisTest) TestPipeliningFromGoroutines(c *C) {
|
func (t *RedisTest) TestPipelineEchoFromGoroutines(c *C) {
|
||||||
pipeline, err := t.client.PipelineClient()
|
pipeline, err := t.client.PipelineClient()
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
|
|
||||||
var Nil = errors.New("(nil)")
|
var Nil = errors.New("(nil)")
|
||||||
|
|
||||||
var errResultMissing = errors.New("Request was not run properly.")
|
var ErrValNotSet = errors.New("redis: value is not set")
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ func (r *BaseReq) Err() error {
|
||||||
return r.err
|
return r.err
|
||||||
}
|
}
|
||||||
if r.val == nil {
|
if r.val == nil {
|
||||||
return errResultMissing
|
return ErrValNotSet
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue