hybridgroup.gobot/platforms/keyboard/keyboard_driver_test.go

36 lines
762 B
Go
Raw Normal View History

2015-07-10 02:33:46 +08:00
package keyboard
import (
"os"
"testing"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/gobottest"
2015-07-10 02:33:46 +08:00
)
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()
gobottest.Assert(t, d.Name(), "keyboard")
gobottest.Assert(t, d.Connection(), (gobot.Connection)(nil))
2015-07-10 02:33:46 +08:00
}
func TestKeyboardDriverStart(t *testing.T) {
d := initTestKeyboardDriver()
gobottest.Assert(t, len(d.Start()), 0)
2015-07-10 02:33:46 +08:00
}
func TestKeyboardDriverHalt(t *testing.T) {
d := initTestKeyboardDriver()
gobottest.Assert(t, len(d.Halt()), 0)
2015-07-10 02:33:46 +08:00
}