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
2015-07-09 11:41:33 -07:00

35 lines
704 B
Go

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