add NewGeoPosCmdResult

GeoPosCmd cannot mock in unit test due to set result function is missing.
This commit is contained in:
Thanabodee Charoenpiriyakij 2019-10-31 11:27:09 +07:00
parent 726ddef6f5
commit 62639928b0
1 changed files with 8 additions and 0 deletions

View File

@ -139,6 +139,14 @@ func NewGeoLocationCmdResult(val []GeoLocation, err error) *GeoLocationCmd {
return &cmd 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 // NewCommandsInfoCmdResult returns a CommandsInfoCmd initialised with val and err for testing
func NewCommandsInfoCmdResult(val map[string]*CommandInfo, err error) *CommandsInfoCmd { func NewCommandsInfoCmdResult(val map[string]*CommandInfo, err error) *CommandsInfoCmd {
var cmd CommandsInfoCmd var cmd CommandsInfoCmd