From 62639928b03f8870e6f869f14289c3431ec0a628 Mon Sep 17 00:00:00 2001 From: Thanabodee Charoenpiriyakij Date: Thu, 31 Oct 2019 11:27:09 +0700 Subject: [PATCH] add NewGeoPosCmdResult GeoPosCmd cannot mock in unit test due to set result function is missing. --- result.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/result.go b/result.go index dfe2938..0878b69 100644 --- a/result.go +++ b/result.go @@ -139,6 +139,14 @@ func NewGeoLocationCmdResult(val []GeoLocation, err error) *GeoLocationCmd { return &cmd } +// NewGeoPosCmdResult returns a GeoPosCmd initialised with val and err for testing +func NewGeoPosCmdResult(val []*GeoPos, err error) *GeoPosCmd { + var cmd GeoPosCmd + cmd.val = val + cmd.setErr(err) + return &cmd +} + // NewCommandsInfoCmdResult returns a CommandsInfoCmd initialised with val and err for testing func NewCommandsInfoCmdResult(val map[string]*CommandInfo, err error) *CommandsInfoCmd { var cmd CommandsInfoCmd