aio: move test read function before event is received

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2017-04-04 10:19:53 +02:00
parent f94bdf5aaf
commit 94f1a6d045
1 changed files with 6 additions and 6 deletions

View File

@ -40,6 +40,12 @@ func TestAnalogSensorDriverStart(t *testing.T) {
a := newAioTestAdaptor()
d := NewAnalogSensorDriver(a, "1")
// send data
a.TestAdaptorAnalogRead(func() (val int, err error) {
val = 100
return
})
gobottest.Assert(t, d.Start(), nil)
// expect data to be received
@ -48,12 +54,6 @@ func TestAnalogSensorDriverStart(t *testing.T) {
sem <- true
})
// send data
a.TestAdaptorAnalogRead(func() (val int, err error) {
val = 100
return
})
select {
case <-sem:
case <-time.After(10 * time.Second):