From 94f1a6d0451d4a9c9ace65b8f4d5651985aedda6 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Tue, 4 Apr 2017 10:19:53 +0200 Subject: [PATCH] aio: move test read function before event is received Signed-off-by: deadprogram --- drivers/aio/analog_sensor_driver_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/aio/analog_sensor_driver_test.go b/drivers/aio/analog_sensor_driver_test.go index f22779b7..c11d9743 100644 --- a/drivers/aio/analog_sensor_driver_test.go +++ b/drivers/aio/analog_sensor_driver_test.go @@ -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):