1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-02 22:17:12 +08:00
hybridgroup.gobot/platforms/keyboard/keyboard_driver_test.go
deadprogram 80cb23de32 core: update Keyboard platform to simply return error
Signed-off-by: deadprogram <ron@hybridgroup.com>
2016-11-07 21:29:51 +01:00

37 lines
708 B
Go

package keyboard
import (
"os"
"testing"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/gobottest"
)
var _ gobot.Driver = (*Driver)(nil)
func initTestKeyboardDriver() *Driver {
d := NewDriver()
d.connect = func(k *Driver) (err error) {
k.stdin = &os.File{}
return nil
}
d.listen = func(k *Driver) {}
return d
}
func TestKeyboardDriver(t *testing.T) {
d := initTestKeyboardDriver()
gobottest.Assert(t, d.Connection(), (gobot.Connection)(nil))
}
func TestKeyboardDriverStart(t *testing.T) {
d := initTestKeyboardDriver()
gobottest.Assert(t, d.Start(), nil)
}
func TestKeyboardDriverHalt(t *testing.T) {
d := initTestKeyboardDriver()
gobottest.Assert(t, d.Halt(), nil)
}