Skip to content

Commit

Permalink
add expect method for the LMove and BLMove redis command go-redis#17
Browse files Browse the repository at this point in the history
  • Loading branch information
burgesQ committed Oct 21, 2021
1 parent 85ddc25 commit 5124588
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions expect.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ type baseMock interface {
ExpectBLPop(timeout time.Duration, keys ...string) *ExpectedStringSlice
ExpectBRPop(timeout time.Duration, keys ...string) *ExpectedStringSlice
ExpectBRPopLPush(source, destination string, timeout time.Duration) *ExpectedString
ExpectBLMove(source, destination, srcpos, destpos string, timeout time.Duration) *ExpectedString
ExpectLIndex(key string, index int64) *ExpectedString
ExpectLInsert(key, op string, pivot, value interface{}) *ExpectedInt
ExpectLInsertBefore(key string, pivot, value interface{}) *ExpectedInt
Expand All @@ -126,6 +127,7 @@ type baseMock interface {
ExpectLTrim(key string, start, stop int64) *ExpectedStatus
ExpectRPop(key string) *ExpectedString
ExpectRPopLPush(source, destination string) *ExpectedString
ExpectLMove(source, destination, srcpos, destpos string) *ExpectedString
ExpectRPush(key string, values ...interface{}) *ExpectedInt
ExpectRPushX(key string, values ...interface{}) *ExpectedInt

Expand Down
14 changes: 14 additions & 0 deletions mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,13 @@ func (m *mock) ExpectBRPopLPush(source, destination string, timeout time.Duratio
return e
}

func (m *mock) ExpectBLMove(source, destination, srcpos, dstpos string, timeout time.Duration) *ExpectedString {
e := &ExpectedString{}
e.cmd = m.factory.BLMove(m.ctx, source, destination, srcpos, dstpos, timeout)
m.pushExpect(e)
return e
}

func (m *mock) ExpectLIndex(key string, index int64) *ExpectedString {
e := &ExpectedString{}
e.cmd = m.factory.LIndex(m.ctx, key, index)
Expand Down Expand Up @@ -1073,6 +1080,13 @@ func (m *mock) ExpectRPopLPush(source, destination string) *ExpectedString {
return e
}

func (m *mock) ExpectLMove(source, destination, srcpos, destpos string) *ExpectedString {
e := &ExpectedString{}
e.cmd = m.factory.LMove(m.ctx, source, destination, srcpos, destpos)
m.pushExpect(e)
return e
}

func (m *mock) ExpectRPush(key string, values ...interface{}) *ExpectedInt {
e := &ExpectedInt{}
e.cmd = m.factory.RPush(m.ctx, key, values...)
Expand Down

0 comments on commit 5124588

Please sign in to comment.