Skip to content

Commit efeb0a2

Browse files
committed
Add test case for command set error
1 parent d52b11c commit efeb0a2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

command_test.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package redis_test
22

33
import (
4+
"errors"
45
"time"
56

6-
"github.com/go-redis/redis/v7"
7+
redis "github.com/go-redis/redis/v7"
78

89
. "github.com/onsi/ginkgo"
910
. "github.com/onsi/gomega"
@@ -84,4 +85,12 @@ var _ = Describe("Cmd", func() {
8485
Expect(err).NotTo(HaveOccurred())
8586
Expect(tm2).To(BeTemporally("==", tm))
8687
})
88+
89+
It("allow to set custom error", func() {
90+
e := errors.New("custom error")
91+
cmd := redis.Cmd{}
92+
cmd.SetErr(e)
93+
_, err := cmd.Result()
94+
Expect(err).To(Equal(e))
95+
})
8796
})

0 commit comments

Comments
 (0)