From b7fd09e59479bc6ed5b3b13c4645a3620fd448a3 Mon Sep 17 00:00:00 2001 From: Dominic Baggott Date: Tue, 5 Apr 2022 07:13:39 +0100 Subject: [PATCH] feat: add NewXPendingResult for unit testing XPending (#2066) --- result.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/result.go b/result.go index 24cfd49..34e9de8 100644 --- a/result.go +++ b/result.go @@ -178,3 +178,11 @@ func NewXStreamSliceCmdResult(val []XStream, err error) *XStreamSliceCmd { cmd.SetErr(err) return &cmd } + +// NewXPendingResult returns a XPendingCmd initialised with val and err for testing. +func NewXPendingResult(val *XPending, err error) *XPendingCmd { + var cmd XPendingCmd + cmd.val = val + cmd.SetErr(err) + return &cmd +}