forked from mirror/redis
Add test case for command set error
This commit is contained in:
parent
d52b11cb42
commit
efeb0a2082
|
@ -1,9 +1,10 @@
|
||||||
package redis_test
|
package redis_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/go-redis/redis/v7"
|
redis "github.com/go-redis/redis/v7"
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
@ -84,4 +85,12 @@ var _ = Describe("Cmd", func() {
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(tm2).To(BeTemporally("==", tm))
|
Expect(tm2).To(BeTemporally("==", tm))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("allow to set custom error", func() {
|
||||||
|
e := errors.New("custom error")
|
||||||
|
cmd := redis.Cmd{}
|
||||||
|
cmd.SetErr(e)
|
||||||
|
_, err := cmd.Result()
|
||||||
|
Expect(err).To(Equal(e))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue