aio: move test read function before event is received
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
f94bdf5aaf
commit
94f1a6d045
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue