From c9f2e839d2ca1fce7d989d29e31f452b35b19804 Mon Sep 17 00:00:00 2001 From: ocallaco Date: Sat, 18 Apr 2020 02:05:16 -0400 Subject: [PATCH] add NewTimeCmdResult to allow unit testing with TimeCmd (#1298) * add NewTimeCmdResult to allow unit testing with TimeCmd Co-authored-by: Conall OCallaghan --- result.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/result.go b/result.go index 4b7de63a..5bec26ca 100644 --- a/result.go +++ b/result.go @@ -98,6 +98,14 @@ func NewStringIntMapCmdResult(val map[string]int64, err error) *StringIntMapCmd return &cmd } +// NewTimeCmdResult returns a TimeCmd initialised with val and err for testing +func NewTimeCmdResult(val time.Time, err error) *TimeCmd { + var cmd TimeCmd + cmd.val = val + cmd.SetErr(err) + return &cmd +} + // NewZSliceCmdResult returns a ZSliceCmd initialised with val and err for testing func NewZSliceCmdResult(val []Z, err error) *ZSliceCmd { var cmd ZSliceCmd