hybridgroup.gobot/commander_test.go

25 lines
500 B
Go
Raw Normal View History

2014-11-30 16:19:53 +08:00
package gobot
import (
"testing"
"github.com/hybridgroup/gobot/gobottest"
)
2014-11-30 16:19:53 +08:00
func TestCommaner(t *testing.T) {
c := NewCommander()
c.AddCommand("test", func(map[string]interface{}) interface{} {
return "hi"
})
if _, ok := c.Commands()["test"]; !ok {
t.Errorf("Could not add command to list of Commands")
}
command := c.Command("test")
gobottest.Refute(t, command, nil)
2014-11-30 16:19:53 +08:00
command = c.Command("booyeah")
gobottest.Assert(t, command, (func(map[string]interface{}) interface{})(nil))
2014-11-30 16:19:53 +08:00
}