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

37 lines
714 B
Go
Raw Normal View History

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