1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-27 13:48:56 +08:00
hybridgroup.gobot/platforms/keyboard/keyboard_driver_test.go
deadprogram c8845a245c core: Refactor Keyboard platform for new Driver creation signatures
Signed-off-by: deadprogram <ron@hybridgroup.com>
2016-09-25 21:27:37 +02:00

37 lines
714 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, len(d.Start()), 0)
}
func TestKeyboardDriverHalt(t *testing.T) {
d := initTestKeyboardDriver()
gobottest.Assert(t, len(d.Halt()), 0)
}