Skip to content

Commit

Permalink
Add test case for command set error
Browse files Browse the repository at this point in the history
  • Loading branch information
git-hulk committed Feb 3, 2020
1 parent d52b11c commit efeb0a2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion command_test.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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))
})
})

0 comments on commit efeb0a2

Please sign in to comment.