From 512458813416dbc576997d3ceef2a0a351bdd935 Mon Sep 17 00:00:00 2001 From: Quentin Burgess Date: Thu, 21 Oct 2021 13:40:15 +0200 Subject: [PATCH] add expect method for the LMove and BLMove redis command #17 --- expect.go | 2 ++ mock.go | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/expect.go b/expect.go index af81a47..64f2e5c 100644 --- a/expect.go +++ b/expect.go @@ -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 @@ -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 diff --git a/mock.go b/mock.go index cf6e351..09edc6b 100644 --- a/mock.go +++ b/mock.go @@ -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) @@ -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...)