add NewTimeCmdResult to allow unit testing with TimeCmd (#1298)

* add NewTimeCmdResult to allow unit testing with TimeCmd

Co-authored-by: Conall OCallaghan <cocallaghan@nvidia.com>
This commit is contained in:
ocallaco 2020-04-18 02:05:16 -04:00 committed by GitHub
parent fc177c3607
commit c9f2e839d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -98,6 +98,14 @@ func NewStringIntMapCmdResult(val map[string]int64, err error) *StringIntMapCmd
return &cmd 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 // NewZSliceCmdResult returns a ZSliceCmd initialised with val and err for testing
func NewZSliceCmdResult(val []Z, err error) *ZSliceCmd { func NewZSliceCmdResult(val []Z, err error) *ZSliceCmd {
var cmd ZSliceCmd var cmd ZSliceCmd