From efeb0a20824809716019f0debabd473df3c4b66e Mon Sep 17 00:00:00 2001 From: git-hulk Date: Mon, 3 Feb 2020 18:18:37 +0800 Subject: [PATCH] Add test case for command set error --- command_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/command_test.go b/command_test.go index a0d753e8..e9fc958c 100644 --- a/command_test.go +++ b/command_test.go @@ -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)) + }) })