Fixes AnalogSensor Halt Test
Signed-off-by: Warren Fernandes <warren.f.fernandes@gmail.com>
This commit is contained in:
parent
922e6d98f7
commit
3f966dc125
|
@ -95,8 +95,15 @@ func TestAnalogSensorDriverStart(t *testing.T) {
|
||||||
|
|
||||||
func TestAnalogSensorDriverHalt(t *testing.T) {
|
func TestAnalogSensorDriverHalt(t *testing.T) {
|
||||||
d := NewAnalogSensorDriver(newGpioTestAdaptor(), "1")
|
d := NewAnalogSensorDriver(newGpioTestAdaptor(), "1")
|
||||||
|
done := make(chan struct{})
|
||||||
go func() {
|
go func() {
|
||||||
<-d.halt
|
<-d.halt
|
||||||
|
close(done)
|
||||||
}()
|
}()
|
||||||
gobottest.Assert(t, len(d.Halt()), 0)
|
gobottest.Assert(t, len(d.Halt()), 0)
|
||||||
|
select {
|
||||||
|
case <-done:
|
||||||
|
case <-time.After(time.Millisecond):
|
||||||
|
t.Errorf("AnalogSensor was not halted")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue