hybridgroup.gobot/commander_test.go

21 lines
355 B
Go
Raw Normal View History

2014-11-30 16:19:53 +08:00
package gobot
import (
"testing"
"github.com/stretchr/testify/assert"
)
2014-11-30 16:19:53 +08:00
func TestCommander(t *testing.T) {
// arrange
2014-11-30 16:19:53 +08:00
c := NewCommander()
c.AddCommand("test", func(map[string]interface{}) interface{} {
return "hi"
})
// act && assert
assert.Len(t, c.Commands(), 1)
assert.NotNil(t, c.Command("test"))
assert.Nil(t, c.Command("booyeah"))
2014-11-30 16:19:53 +08:00
}