Fixes AnalogSensor Halt Test

Signed-off-by: Warren Fernandes <warren.f.fernandes@gmail.com>
This commit is contained in:
Warren Fernandes 2016-10-27 03:32:56 -06:00
parent 922e6d98f7
commit 3f966dc125
1 changed files with 7 additions and 0 deletions

View File

@ -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")
}
} }