Add test case for command set error

This commit is contained in:
git-hulk 2020-02-03 18:18:37 +08:00
parent d52b11cb42
commit efeb0a2082
1 changed files with 10 additions and 1 deletions

View File

@ -1,9 +1,10 @@
package redis_test
import (
"errors"
"time"
"github.com/go-redis/redis/v7"
redis "github.com/go-redis/redis/v7"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@ -84,4 +85,12 @@ var _ = Describe("Cmd", func() {
Expect(err).NotTo(HaveOccurred())
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))
})
})